Jump to content
  • Advertisement

Archived

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

6Gold

Making a start screen and then switching to a new screen

This topic is 6193 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

How do I make a start screen, then press a button and have a different screen? I know this is probably simple, but I think I''m thinking to complex (not smart, I mean difficult) If anyone replies thanks... 6 Gold Work hard today so tomorrow will be easy.

Share this post


Link to post
Share on other sites
Advertisement
create an enumerated type such as:

enum GAME_STATE { MAIN_MENU, LOAD_LEVEL, RUN_LEVEL, UNLOAD_LEVEL }


then in your main game loop switch between states:


while( game_is_running )
{
switch( game_state )
{
case MAIN_MENU:
DrawStartScreen();
if( enter_key_pressed ) game_state = LOAD_LEVEL;
break;

case LOAD_LEVEL:
LoadLevelData();
game_state = RUN_LEVEL;
break;
.
.
.
}


The above code is just psuedo code. It won''t work if you just copy and paste, but hopefully you get the idea.

Useless Code

Share this post


Link to post
Share on other sites
Just use a code like this:



int introKey(char k, int x, int y)
{
if(k == ''q'')
{
glutKey(gameKey);
glutDisplay(gameDisplay);
glutDisplay(gameIdle);
...
}

}

void main()
{
glutKey(introKey);
glutDisplay(introDisplay);
glutIdle(introIdle);
...
glutMainLoop();
}

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!