GP2X Handling Game States


timbobsteve

Member
Joined
Oct 4, 2005
Messages
301
Hi All,

A while ago when I first started learning SDL and C++ I was reading a really great tutorial on handling gamestates using STL and function pointers to each game state. Unfortunately I can't rellocate the same tutorial. I was wondering if anyone has any links to good tutorials that deal with game state handling?

Thanks.
 
what sort of game are you doing?

in mine, I just have a simple loop where it shows intro, credits, and then goes to the game (I only have a simple on screen, one stage game)

I just used a small loop where I loaded a state, then loaded the next after 3 seconds, then loaded the next after 2 seconds

simple , maybe to simple, and pretty crude, and I did it in C++

~Octavious
 
My setup is pretty simple:

Code:
int getGameState(){
	return theState;
}

void setGameState(int setstate){
	theState = setstate;
}


void drawGameState(){
	switch (theState){
  case 1:
  drawTitle();
  break;

  case 2:
  drawPlayArea();
  break;

  case 3:
  drawInstructions();
  break;

  case 4:
  drawIntro();
  break;

  case 5:
  drawScore();
  break;

  case 6:
  drawCredits();
  break;

  case 7:
  drawHighScores();
  break;


	}

}

Chimpoid
 
Back
Top