In the file ‘gamestate’, you add three functions: GameInit, GameUpdate and GameDraw. These functions will be left empty for now, although you can already draw the background if you like. You also need to declare this new application state. Here you can see how this file should look right now:
bool GameInit()
{
return true;
}
5
bool GameUpdate()
{
if(Kb.bp(KB_ESC)) return false;
return true;
10}
void GameDraw()
{
Background.draw();
15}
State GameState(GameUpdate, GameDraw, GameInit);
Now add some code to the Update function of the initial state: when you press the space bar, your application should switch over to the GameState, with a fade of 0.4 seconds. (If you do not know how to do that, look in Chapter 15.
Test your application to see if the switch works.