Handling buttons on key up

This commit is contained in:
Zoe Roux
2021-06-18 12:42:51 +02:00
parent 673d4f446d
commit 8d9432c1f4
6 changed files with 18 additions and 10 deletions
+6 -1
View File
@@ -64,6 +64,7 @@ namespace BBM
engine.shouldClose = true;
if (gameState.currentScene == GameState::SceneID::GameScene) {
for (auto &[_, component]: engine.getScene()->view<ControllableComponent>()) {
component.fastClick = true;
if (component.pause && gameState.currentScene == GameState::SceneID::GameScene) {
gameState.nextScene = GameState::SceneID::PauseMenuScene;
break;
@@ -72,8 +73,12 @@ namespace BBM
}
if (gameState.nextScene == gameState.currentScene)
return;
if (gameState.nextScene == GameState::SceneID::ScoreScene)
if (gameState.nextScene == GameState::SceneID::ScoreScene) {
gameState._loadedScenes[GameState::SceneID::ScoreScene] = Runner::loadScoreScene(*engine.getScene());
for (auto &[_, component]: engine.getScene()->view<ControllableComponent>()) {
component.fastClick = false;
}
}
gameState._loadedScenes[gameState.currentScene] = engine.getScene();
engine.changeScene(gameState._loadedScenes[gameState.nextScene]);
gameState.currentScene = gameState.nextScene;