diff --git a/src/Client/Systems/Menus/Menu/MenuSystems.cpp b/src/Client/Systems/Menus/Menu/MenuSystems.cpp index f12f17e0..2f60047a 100644 --- a/src/Client/Systems/Menus/Menu/MenuSystems.cpp +++ b/src/Client/Systems/Menus/Menu/MenuSystems.cpp @@ -228,15 +228,23 @@ namespace Systems { void quitScene(std::size_t /*unused*/, std::size_t /*unused*/) { + static std::size_t clockId = Registry::getInstance().getClock().create(); + if (Raylib::KeyboardInput::isKeyPressed(Raylib::KeyboardKey::KB_ESCAPE)) { + if (Registry::getInstance().getClock().elapsedMillisecondsSince(clockId) < 300) { + return; + } + Registry::getInstance().getClock().restart(clockId); switch (Scene::SceneManager::getInstance().getCurrentScene()) { - case MENU: Scene::SceneManager::getInstance().stop(); break; + case MENU: Logger::fatal("in menu"); Scene::SceneManager::getInstance().stop(); break; case CREATE_LOBBY_SCENE: + Logger::fatal("in select create lobby"); Scene::SceneManager::getInstance().changeScene(SELECT_LOBBY); break; - case SELECT_LOBBY: Scene::SceneManager::getInstance().changeScene(MENU); break; - case CREATE_SERVER_SCENE: Scene::SceneManager::getInstance().changeScene(MENU); break; + case SELECT_LOBBY: Logger::fatal("in select lobby"); Scene::SceneManager::getInstance().changeScene(MENU); break; + case CREATE_SERVER_SCENE: Logger::fatal("in create server"); Scene::SceneManager::getInstance().changeScene(MENU); break; case GAME: + Logger::fatal("in game"); Nitwork::NitworkClient::getInstance().disconnectLobby(); Types::WaveInfos::getInstance().reset(); Scene::SceneManager::getInstance().changeScene(SELECT_LOBBY);