All we have left to do now is to put everything together. We're going to be using a Game
class for that, so let's take a look at it:
class Game{ public: Game(); ~Game(); void Update(); void Render(); void LateUpdate(); sf::Time GetElapsed(); Window* GetWindow(); private: void SetUpClasses(); void SetUpECS(); void SetUpStates(); void RestartClock(); sf::Clock m_clock; sf::Time m_elapsed; SharedContext m_context; RandomGenerator m_rand; Window m_window; TextureManager m_textureManager; FontManager m_fontManager; AudioManager m_audioManager; SoundManager m_soundManager; GUI_Manager m_guiManager; SystemManager m_systemManager; EntityManager m_entityManager; Map m_gameMap; std::unique_ptr<StateManager> m_stateManager; };
This class holds all of the classes that we covered, so let us begin setting them up in the constructor:
Game::Game() : m_window("Chapter 2", sf::Vector2u(800, 600), false...