Page 1 of 1

Go OOP!

Posted: Tue Feb 27, 2007 11:56 pm
by Charles256

Code: Select all

int main(void)
{
	setup();
	buffering game_screen;
	main_menu my_main_menu(game_screen);
	while(!key[KEY_ESC])
	{
		my_main_menu.render_menu();		
		game_screen.render();
	}
	game_screen.destroy_bitmaps();
    allegro_exit();
	return 0;
}
END_OF_MAIN()
bet ya can't guess what it does :-D

Posted: Wed Feb 28, 2007 12:40 am
by feyd
Blow up during compilation?

Posted: Wed Feb 28, 2007 12:42 am
by Christopher
Where's the OOP in your game loop?

Posted: Wed Feb 28, 2007 2:54 am
by Maugrim_The_Reaper
Looks like a continuous GUI refill loop which I would guess uses the Allegro Game lib ;). The naming suggests a startup menu prior to starting a new game?

Posted: Wed Feb 28, 2007 10:41 am
by Charles256
feyd: despite initial fears, no. :)
arborint: darn you.
reaper: twelve trillion points for guessing the library. :-D If I would have removed the allegro_exit (Which i have done since) you would have been lost! :-D I am abstracting allegro from itself mainly because it's so damn repetetive. I know, harsh, but true. However, you are absolutely correct. It's the main menu prior to starting a new game which I am finally doing now that I can speak allegro. Or at least ernough to attempt this. Who wants in on it?! :-D

Posted: Wed Feb 28, 2007 11:20 am
by Maugrim_The_Reaper
I do my time in games in a few languages - I used Allegro in a small game a long time back. The KEY_ESC condition was a dead giveaway more than anything - where else in a game does ESC break a refresh loop? ;)

Posted: Wed Feb 28, 2007 11:26 am
by Charles256
darn. I shoulda waited till tonight to post it then because I am removing the key_esc for more traditional methods, i.e. quit game selected, user hit esc then hit quit game,etc. :-D