You can use this code for StateGame. Again, add this code in a separate file.
bool InitGame() {return true;}
void ShutGame() {}
bool UpdateGame()
5{
if(Kb.bp(KB_ESC))StateMenu.set(1.0);
return true;
}
10void DrawGame()
{
D.clear(TURQ);
D.text (0, 0, ”Game”);
}
15
State StateGame(UpdateGame, DrawGame, InitGame, ShutGame);
You will switch back to StateMenu by pressing escape. In a real game you will lot of other code in the update function.