Exemple #1
0
	HexagonGame::HexagonGame(HGAssets& mAssets, GameWindow& mGameWindow) : assets(mAssets), window(mGameWindow), fpsWatcher(window)
	{
		game.onUpdate += [this](float mFT) { update(mFT); };
		game.onDraw += [this]{ draw(); };
		window.onRecreation += [this]{ initFlashEffect(); };

		add3StateInput(game, Config::getTriggerRotateCCW(), Config::getTriggerRotateCW(), inputMovement);
		add2StateInput(game, Config::getTriggerFocus(), inputFocused);
		add2StateInput(game, Config::getTriggerSwap(), inputSwap);
		game.addInput(Config::getTriggerExit(),			[this](float){ goToMenu(); });
		game.addInput(Config::getTriggerForceRestart(),	[this](float){ status.mustRestart = true; });
		game.addInput(Config::getTriggerRestart(),		[this](float){ if(status.hasDied) status.mustRestart = true; });
		game.addInput(Config::getTriggerScreenshot(),	[this](float){ mustTakeScreenshot = true; }, Input::Trigger::Type::Once);
	}
Exemple #2
0
	HexagonGame::HexagonGame(GameWindow& mGameWindow) : window(mGameWindow), fpsWatcher(window)
	{
		initFlashEffect();

		game.onUpdate += [&](float mFrameTime) { update(mFrameTime); };
		game.onDraw += [&]{ draw(); };

		add3StateInput(game, getTriggerRotateCCW(), getTriggerRotateCW(), inputMovement);
		add2StateInput(game, getTriggerFocus(), inputFocused);
		game.addInput(getTriggerExit(),			[&](float){ goToMenu(); });
		game.addInput(getTriggerForceRestart(),	[&](float){ status.mustRestart = true; });
		game.addInput(getTriggerRestart(),		[&](float){ if(status.hasDied) status.mustRestart = true; });
		game.addInput(getTriggerScreenshot(),	[&](float){ mustTakeScreenshot = true; }, Input::Trigger::Type::Single);
	}