void GameStateManager::goToWinScreen() { currentGameState = GS_WIN_SCREEN; if (isWorldRenderable()) unloadCurrentLevel(); //graphics->clearWorldTextures(); }
void GameStateManager::goToGameOver() { currentGameState = GS_GAME_OVER; if (isWorldRenderable()) unloadCurrentLevel(); //graphics->clearWorldTextures(); }
/* shutdown - this method is called when the user wants to quit the application. This method updates the game state such that all world resources are released and the game loop does not iterate again. */ void GameStateManager::shutdown() { // MAKE SURE THE GAME LOOP DOESN'T GO AROUND AGAIN currentGameState = GS_EXIT_GAME; // CLEAR LEFT OVER DATA if (isWorldRenderable()) unloadCurrentLevel(); }
/* loadLevel - This method changes the current level. This method should be called before loading all the data from a level file. */ void GameStateManager::loadLevel(Game *game, unsigned int initLevel) { if ((initLevel > NO_LEVEL_LOADED) && (initLevel <= levelNames.size())) { if (currentLevel != NO_LEVEL_LOADED) unloadCurrentLevel(); currentLevel = initLevel; wstring fileToLoad = levelFileNamesWithRelativePath[currentLevel]; GameDataLoader *dataLoader = game->getDataLoader(); dataLoader->loadWorld(game, fileToLoad); } }