コード例 #1
0
ファイル: GameController.cpp プロジェクト: sangar/Snake
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);
		}
	}
}
コード例 #2
0
ファイル: PlayArea.cpp プロジェクト: sangar/NITHris
/*
* Method shows menu
*/
void PlayArea::showMenu(GameStatus gameStatus)const
{
	if(gameStatus.getGameStatus() == gameStatus.NEW_GAME_MENU)
		outputManager->DrawStartupMessage();
	else
		outputManager->DrawGameOverMessage();
	outputManager->OutputGraphics();
}