June 2013
Beginner to intermediate
296 pages
6h 50m
English
Since we have now more states than the game itself, we create a new class Application that controls input, logic updates, and rendering. Having a ready StateStack implementation waiting to be used, it is time to promote it into the Application class. We will plug our new state architecture into our Application class and then start using it!
First, we add the mStateStack member variable to Application. We register all the states in an own method:
void Application::registerStates()
{
mStateStack.registerState<TitleState>(States::Title);
mStateStack.registerState<MenuState>(States::Menu);
mStateStack.registerState<GameState>(States::Game);
mStateStack.registerState<PauseState>(States::Pause);
}Now there ...
Read now
Unlock full access