It's how you have your loop setup. If Enter is pressed then text is going to be blitted to the buffer. Then at the end of the loop the buffer is cleared, however, the text still appears on the screen, because the screen has not been cleared, only the buffer. If Enter is not pressed again, then there will be no text blitted to the buffer before the buffer is blitted to the screen, which will delete the previous text on the screen. A possible solution is to change your code to this...
Code:
BITMAP *TEXT_BMP;
TEXT_BMP = create_bitmap(200, 200); //any size you would like
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;
clear (TEXT_BMP); //to let new text appear clearly
textprintf (TEXT_BMP, font, 10, 10, makecol (255,100,100), "new game - enter pressed");
}
else if ( (key[KEY_ENTER]) && (i == 1) )
{
key[KEY_ENTER] = FALSE;
clear (TEXT_BMP); //to let new text appear clearly
textprintf (TEXT_BMP, 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(TEXT_BMP, ScreenBuffer, 0, 0, 10, 10, 640, 480)
blit (ScreenBuffer, screen, 0, 0, 0, 0, 640, 480);
clear (ScreenBuffer);
release_screen ();
}
This is going to make sure that the text will always stay on the screen once it first appears, and when new text needs to be written the TEXT_BMP will be cleared, so the text won't overlap.
Btw, usually you don't need to use acquire_screen() and release_screen() unless you're going to be using video memory and not virtual memory. At least that's what I do.
ps If you have any questions regarding Allegro feel free to send me a PM at anytime.