0

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

Attachments 1aaa.JPG 20.92 KB
2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by gunbuster363
0

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.

0

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?

0

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?

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.