• Advertisement

Archived

This topic is now archived and is closed to further replies.

Menu Screens

This topic is 6455 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am finished with my game, and I am interested in making a menu screen where you can choose "New Game," "About," "Controls," "Quit," etc. Would I need a switch to do that? I am not really sure how I would use the switch. Thanks! -Alex

Share this post


Link to post
Share on other sites
Advertisement
The way my game works is you have a main game loop which checks for windows messages, if there, it processes them, if not it continues, then it calls a procedure called Game_Main which occurs every loop iteration, does this make sense?
Well within my Game_Main procedure I have what in C you''d call a switch (I think) but I''m using assembler. Basically I have a variable called GameState which will change to a number of constant call GS_PLAY, GS_MENU, GS_EXIT, etc... so the procedure checks this variable and if it''s GS_PLAY it plays the game normally, if it''s GS_MENU it display''s the menu, if it''s GS_EXIT it clean''s up and quit''s. Obviously it''s a little more complex than that, but this should inspire you enough!
Hope this helped!
See ya,
Ben

Share this post


Link to post
Share on other sites
Finally, someone with a game who wants to make a menu, as opposed to the other way around!

switch (someTypeOfInput) {
case 1: { //in case someTypeOfInput is equal to 1
quit();
} break;
case 2: {
options();
} break;
case 3: {
etc();
} break;
}


i hope that helps you somehow


If all these errors are so fatal, why am I still alive?

Share this post


Link to post
Share on other sites
Hey, a finished game! I''d like to see it. Do you have any screen shots or anything we can look at? Let us know, it''s exciting to see someone''s finished product!

Congrats on your accomplishment!

Torus

"Impressive!!!"

Share this post


Link to post
Share on other sites
Here''s my overkill method. I create a class called CScreen, which has virtual funcs like Tick() (called every frame), RestoreSurfaces(), etc., and there''s a global pointer to such a class that represents the current "screen". Every time the application does an action, the current screen does them too. There are several classes derived from it, like a CGameScreen or a CMenuScreen that override the virtual functions. So, you''d start out setting the pointer to a CTitleScreen, and then it would end and point the pointer to a CMenuScreen, and on and on. Very clean, but more code than it''s worth, maybe.

lntakitopi@aol.com | http://geocities.com/guanajam/

Share this post


Link to post
Share on other sites

  • Advertisement