Jump to content

  • Log In with Google      Sign In   
  • Create Account

Making a start screen and then switching to a new screen


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 6Gold   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 August 2001 - 02:26 AM

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.

#2 Mike   Members   -  Reputation: 141

Like
Likes
Like

Posted 02 August 2001 - 02:41 AM

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

#3 bobatefrei   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 August 2001 - 04:25 AM

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();
}





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS