Thread: textprintf - how to blit it?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669

    Question textprintf - how to blit it?

    Hi!

    When I use functions blit and draw_sprite in Allegro everything works fine. But I just can't figure what to do that the blit function will be working with the textprintf function. Everytime I use textprintf it gets deleted right away so the text is seen only for a milisecond.
    Here's the code:
    Code:
    .
    .
    .
    while (Loop)
    	{
    		// keyboard
    		if (key[KEY_UP])
    		{
    			key[KEY_UP] = FALSE;
    			i--;
    			if (i < 0) i = 1;
    		}
    		else if (key[KEY_DOWN])
    		{
    			key[KEY_DOWN] = FALSE;
    			i++;
    			if (i > 1) i = 0;
    		}
    		else if ( (key[KEY_ENTER]) && (i == 0) )
    		{
    			key[KEY_ENTER] = FALSE;
    			textprintf (ScreenBuffer, font, 10, 10, makecol (255,100,100), "new game - enter pressed");
    		}
    		else if ( (key[KEY_ENTER]) && (i == 1) )
    		{
    			key[KEY_ENTER] = FALSE;
    			textprintf (ScreenBuffer, font, 10, 10, makecol (255,100,100), "exit - enter pressed");
    			Loop = FALSE;
    		}
    		// blittering
    		acquire_screen ();
    		draw_sprite (ScreenBuffer, NewGame01, 100, 100);
    		draw_sprite (ScreenBuffer, Exit01, 100, 200);
    		draw_sprite (ScreenBuffer, MenuHL[i], MenuX[i], MenuY[i]);
    		blit (ScreenBuffer, screen, 0, 0, 0, 0, 640, 480);
    		clear (ScreenBuffer);
    		release_screen ();
    	}
    .
    .
    .
    Help!
    Last edited by GaPe; 05-03-2003 at 09:54 AM.
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alegro help with rest, varibles, and textprintf
    By campsoup1988 in forum C++ Programming
    Replies: 0
    Last Post: 02-06-2006, 06:48 PM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  3. Help with blit
    By boontune in forum Game Programming
    Replies: 1
    Last Post: 01-17-2005, 03:35 PM
  4. Allegro and blit()
    By Paninaro in forum Game Programming
    Replies: 1
    Last Post: 07-06-2002, 04:52 PM
  5. My Allegro Program will not run...
    By Vicious in forum Game Programming
    Replies: 17
    Last Post: 06-14-2002, 12:49 AM