void GameStateManager::ChangeState(GameState& gs) { while (!GameStates.empty()) GameStates.pop(); if (!gs.Loaded) gs.Initialize(); GameStates.push(&gs); }
int main() { // Load in game data std::unique_ptr<IDungeonBuilder> dungeonBuilder = std::unique_ptr<IDungeonBuilder>(new StandardDungeonBuilder()); std::shared_ptr<IDungeon> dungeon = CreateDungeonFromXml(L"Content\\adventure.xml", *dungeonBuilder); // Start up main game loop GameState gameState = GameState(); gameState.Initialize(); gameState.BeginDungeon(dungeon); bool stillPlaying = true; while (stillPlaying) { stillPlaying = gameState.RunGameLoopStep(); } return 0; }
void GameStateManager::PushState(GameState& gs) { if (!gs.Loaded) gs.Initialize(); GameStates.push(&gs); }