Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


minus4th

Member Since 01 Mar 2005
Offline Last Active Yesterday, 07:18 AM

Topics I've Started

AllegroFont question

29 December 2006 - 10:56 AM

I've looked around, googled and searched the forums. I hope I'm not missing a thread about this already... Anyways, I'm trying to use the AllegroFont extension. It loads fine with no error, THe font loads with no error. I however am getting an error when I use alfont_textout(). Here is a screeny of the error: Here is my code:
#include "allegro.h"
#include "alfont.h"

int main()
{
    ALFONT_FONT *font_test;
    allegro_init();

    /* now init AllegroFont */
    if (alfont_init() != ALFONT_OK)
    {
        allegro_message("Error while initializing alfont");
        allegro_exit();
    }

    install_keyboard();
    install_timer();
    srand(time(NULL));

    set_color_depth(32);
    int ret = set_gfx_mode(MODE,WIDTH,HEIGHT,0,0);
    if (ret != 0)
    {
        allegro_message(allegro_error);
    }

    // load the font
    font_test = alfont_load_font("data/JUICE___.TTF");
    if (font_test == NULL)
    {
        allegro_message("Cannot load the font");
    }

    // This is the line thats erroring out on me ***************************/
    alfont_textout(screen,font_test,"TEST TEXT",25,25,makecol(255,255,255));
    /***********************************************************************/

    while(!key[KEY_ESC])

    alfont_destroy_font(font_juice);

    alfont_exit();
    allegro_exit();
}
END_OF_MAIN();

I'm lost at the moment but i am still going to keep looking. It's probably something stupid i'm missing ayways...

messed up

21 April 2006 - 04:19 AM

I just found out yesterday that my roomate has not paid the rent in two months... I paid my share but he never paid the apartment complex. I have no clue what happened with the money I paid but they are threating to evict us if the two months is not paid by the 25th. I've never been evicted before so i'm kinda pissed about this. Luckinly for me (somewhat) I was never put on the lease so it will not mess up my credit. I've yet to talk with him about it but I plan on talking with him tonight after I get home from work. I looked into another apartment yesterday and I should know if I get it by 6pm today. Has anyone here ever had this happen to them? If anyone knows, I just want to make sure as i've never been evicted before, but they have to give you a month to get out of the apartment right?

I can't get my font size to change??

09 December 2005 - 07:07 AM

Hello, I've been going through the NeHE Lessons and I am now on Lesson 13. I can get it to run fine but when I try to change the size of the font It will not get smaller or bigger... I've looked at the documentation on msdn and searched google on the CreateFont function and i'm getting no luck... I'm looking for a pointer as to why my text won't change size.. Here is the code I am using...
GLvoid BuildFont(bool outline) {
       HFONT font;
       HFONT oldFont;
       
       // int PointSize = 0;
       // int nHeight = -MulDiv(PointSize, GetDeviceCaps(_pGame->GetHDC(), 
       //              LOGPIXELSY), 72);
       
       if (outline == true) { // Comic Sans MS
          MessageBox(NULL, "Outline", "Outline", MB_OK);
          base = glGenLists(256);
          font = CreateFont(-12,0,0,0,FW_BOLD,false,false,false,ANSI_CHARSET,
                             OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,
                             FF_DONTCARE | DEFAULT_PITCH,"Comic Sans MS");
       }
       else {
            MessageBox(NULL, "Bitmap", "Bitmap", MB_OK);
           base = glGenLists(96);
           font = CreateFont(-24,0,0,0,FW_BOLD,false,false,false,ANSI_CHARSET,
                             OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,
                             FF_DONTCARE | DEFAULT_PITCH,"Courier New");
       }
       
       oldFont = (HFONT)SelectObject(_pGame->GetHDC(),font);
       
       if (outline == true) {
          MessageBox(NULL, "Outline", "Outline", MB_OK);
          wglUseFontOutlines(_pGame->GetHDC(),0,255,base,0.0f,0.2f,
                            WGL_FONT_POLYGONS,gmf);
       }
       else {
            MessageBox(NULL, "Bitmap", "Bitmap", MB_OK);
            wglUseFontBitmaps(_pGame->GetHDC(),32,96,base);
       }
       
       SelectObject(_pGame->GetHDC(),oldFont);
       DeleteObject(font);
}

GLvoid glPrint(bool outline, const char *fmt, ...) {
       
       float   lenght = 0;
       char    text[256];
       va_list ap;
       
       if (fmt == NULL) {
          return;
       }
       
       va_start(ap,fmt);
           vsprintf(text,fmt,ap);
       va_end(ap);
       
       for (unsigned int loop = 0; loop < (strlen(text)); loop++) {
           lenght += gmf[text[loop]].gmfCellIncX;
       }
       
       glTranslatef(-lenght/2,0.0f,0.0f);
       
       glPushAttrib(GL_LIST_BIT);
       
       if (outline) {
          glListBase(base);
       }
       else {
            glListBase(base - 32);
       }
       
       glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);
       glPopAttrib();
}

int DrawGLScene(GLvoid) {                             // Heres where we do ALL the drawing
       
       // Clear the screen and the depth buffer
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       glLoadIdentity();
       
       DrawMap();
       
       
       glEnable(GL_COLOR_MATERIAL);
       glEnable(GL_LIGHTING);
       glTranslatef(0.0f,0.0f,-1.5f);
       glColor3f(1.0f,1.0f,0.0f);
       glPrint(true, "Lotas - %3.2f", rot/50);
       glDisable(GL_COLOR_MATERIAL);
       glDisable(GL_LIGHTING);
       
       glColor3f(1.0f,1.0f,1.0f);
       
       rot += 0.1f;
       
       return true;                                   // Everything went OK
}

int initGL(GLvoid) {                                  // All setup for openGL goes here
       
       // Start Of User Initialization
       if (!LoadBitmap("Data/wall.bmp", texture[0], GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, 1)) // Load The Bitmap
		  return FALSE;
       if (!LoadBitmap("Data/floor.bmp", texture[1], GL_LINEAR, GL_LINEAR, 0)) // Load The Bitmap
		  return FALSE;	
       if (!LoadBitmap("Data/ceiling.bmp", texture[2], GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, 1)) // Load The Bitmap
		  return FALSE;
       if (!LoadBitmap("Data/lobManga5.bmp", texture[3], GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, 1)) // Load The Bitmap
		  return FALSE;
       if (!LoadBitmap("Data/door1.bmp", texture[4], GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, 1)) // Load The Bitmap
		  return FALSE;
       if (!LoadBitmap("Data/Glass.bmp", texture[5], GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, 1)) // Load The Bitmap
		  return FALSE;
       
       // glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
       
       glEnable(GL_TEXTURE_2D);                       // Enable Texture mapping
       glBlendFunc(GL_SRC_ALPHA, GL_ONE);
       glClearColor(0.0f,0.0f,0.0f,0.0f);             // Black Background
       glClearDepth(1.0f);                            // Depth Buffer setup
       glDepthFunc(GL_LEQUAL);                        // The type of Depth Test to do
       glEnable(GL_DEPTH_TEST);                       // Enable Depth Testing
       glShadeModel(GL_SMOOTH);                       // Enable smooth shading
       // Really nice perspective calculations
       glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
       
       glEnable(GL_LIGHT0);
       
       
       
       BuildFont(true);
       
       SetupWorld();
       
       return true;                                   // Initialization went OK
}

I'm trying to add some text to a map I created. I want to move the text with the camera but first I need to get it to be much smaller... If you need more code just let me know :) Thanks in advance for the help :)

Win32 API Dialog box - [resource error] Syntax error - Dev-c++

26 November 2005 - 12:11 PM

Whew, that was a long title... anyways. I've been googling till i couldn't google anymore. I have this silly little error with my resource file. I am trying to create an about dialog box from the #winprog.org tutorials. I am almost coping word for word at this point. I've tried what i could find on the msdn site and googles to hell and back... I'm getting a [Resource error] Syntax error I'm using c++ Using Dev-C++ Heres is my .rc file
// Include files
#include <windows.h>
#include "resource.h"

// -------------------- ICON FILES ------------------------- //
IDI_SKELETON         ICON   "Skeleton.ico"
IDI_SKELETON_SM      ICON   "Skeleton_sm.ico"

// -------------------- BITMAP FILES ----------------------- //

// -------------------- MENU RESOURCES --------------------- //
IDR_MAINMENU    MENU
BEGIN
     POPUP "&File"
     BEGIN
          MENUITEM "E&xit", IDM_FILE_EXIT
     END
     
     POPUP "&Stuff"
     BEGIN
          MENUITEM "&Go", IDM_STUFF_GO
          MENUITEM "Go &Somewhere Else", 0, GRAYED
     END
     
     POPUP "&Help"
     BEGIN
          MENUITEM "&About", IDM_HELP_ABOUT
     END
END

// --------------------- DIALOG RESOURCES ------------------- //
IDD_ABOUT DIALOG DISCARDABLE 0, 0, 239, 66
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "My About Box"
FONT 8, "MS Sans Sarif"
BEGIN
     GROUPBOX      "About this program...",IDC_STATIC,7,7,225,52
     CTEXT         "A program for the crual pleasure of the lord of bread\r\n\r\n By: The Lord of Bread",IDC_STATIC,16,18,144,33
     DEFPUSHBUTTON "&OK",IDOK,174,18,50,14
     PUSHBUTTON    "&Cancel",IDCANCEL,174,35,50,14
END

I'm getting the syntax error on these lines...
GROUPBOX      "About this program...",IDC_STATIC,7,7,225,52
CTEXT         "A program for the crual pleasure of the lord of bread\r\n\r\n By: The Lord of Bread",IDC_STATIC,16,18,144,33

I can't for the life of me see where i am missing something... This works fine in MSVS.NET (of course it auto generates teh file for me)... If you need more info let me know.. Thanks for the help :)

Advanced Guess the Number

09 August 2005 - 05:11 AM

Hello gamedev! I have finally arrived at my final destination in FL and also finished my first game, one that I didn't from a tutorial. I'm going to put it for download and ask for any feedback to my game, good - bad, either way I'll take it as constructive criticism. Here are my game stats: Name: Advanced Guess the Number Language: C/C++ Size: 124kb Features: Full Menu System Keeps score Coded in: Visual Studio .NET 2003 Download here Let me know if you would like to see the source code and I'll upload that as well. Thanks and I hope you enjoy my little game!!!

PARTNERS