void GameController::initGame() { //Initializing variables DrawEngine drawEngine; CInputManager inputManager; CLoopTimer loopTimer; CollisionDetector collisionDetector; FoodProvider foodProvider; GameStatus gameStatus; //Initializing console drawEngine.initialize(); collisionDetector.initialize(drawEngine.getWindownWidth(), drawEngine.getMenuBorderHeight()); //Set start values gameStatus.setGameStatus(gameStatus.MAIN_MENU); unsigned long score = 0; while(gameStatus.getGameStatus() != gameStatus.QUIT) { //Runs main menu if(gameStatus.getGameStatus() == gameStatus.MAIN_MENU) { drawEngine.showMenu(inputManager, gameStatus); } //Run game else { score = 0; runGame(inputManager, loopTimer, score, collisionDetector, foodProvider, drawEngine); gameStatus.setGameStatus(gameStatus.MAIN_MENU); } } }
/* * Method shows menu */ void PlayArea::showMenu(GameStatus gameStatus)const { if(gameStatus.getGameStatus() == gameStatus.NEW_GAME_MENU) outputManager->DrawStartupMessage(); else outputManager->DrawGameOverMessage(); outputManager->OutputGraphics(); }