Hi all,
I am new to game programming for my own interest. I just tried to use allegro to draw something according to a tutorial online. But I have a little problem, below is my code:
#include<allegro.h>
int main()
{
int x = 10;
int y = 10;
allegro_init();
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
install_keyboard();
while(!key[KEY_ESC])
{
clear_keybuf();
acquire_screen();
textout_ex(screen, font, " ", x, y, makecol(0,0,0), makecol(0,0,0));
if(key[KEY_UP])
--y;
else if(key[KEY_DOWN])
++y;
else if(key[KEY_LEFT])
--x;
else if(key[KEY_RIGHT])
++x;
textout_ex(screen, font, "LLLLL", x, y, makecol(255,0,0), makecol(0,0,0));
release_screen();
rest(10);
}
return 0;
}
END_OF_MAIN();
This program will draw some text on the screen, and when we press any of the arrow keys, the position of the text will be adjust. But in this test program, the letter "LLLLL" will leave some vertical line on the screen when I press down, and the vertical lines will disappear accordingly when I press up. What is the problem???