December 2015
Beginner to intermediate
522 pages
11h 21m
English
While it's not quite time for fanfare, excitement is definitely in order because we can finally put our brand new StateManager class to work! The Game class header modification is a good start:
...
#include "StateManager.h"
...
class Game{
public:
...
void LateUpdate();
private:
...
StateManager m_stateManager;
};Sticking a new data member to the Game class and adding a new method for late updating are all the adjustments that need to be made in the header. Let's adjust the Game constructor to initialize the state manager:
Game::Game(): m_window("Chapter 5", sf::Vector2u(800, 600)), m_stateManager(&m_context) { ... m_context.m_wind = &m_window; m_context.m_eventManager = m_window.GetEventManager(); m_stateManager.SwitchTo(StateType::Intro); ...Read now
Unlock full access