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!