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???

Wow I haven't done allegro in a long time...
I think the problem may be that you need to clear the screen before you re-draw the text.

Wow I haven't done allegro in a long time...
I think the problem may be that you need to clear the screen before you re-draw the text.

dude, does allegro old? What tools/api you use to make game?

I'd say allegro is fairly old. Doesn't mean it's not any good. I started out with it and it certainly helped me. I use PyGame and OpenGL with Python nowadays.
Did I solve your problem?

Dunno...after I uninstalled the configured vs2010 and install vs2008 instead,
I cannot make use of allegro anymore because of wrong configuration!

gave up. Now I am able to use opengl with glut instead

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.