diff --git a/src/Game.cpp b/src/Game.cpp index a07e523..6a7d2c8 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -210,7 +210,7 @@ namespace ZL catch (const std::exception& e) { std::cerr << "Failed to load UI: " << e.what() << std::endl; } - + //menuManager.setupMainMenu(); loadingCompleted = true; if (audioPlayer->init()) { @@ -226,7 +226,7 @@ namespace ZL this->updateMusicForGameState(newState); }; - menuManager.setupMainMenu(); + //menuManager.setupMainMenu(); SDL_ShowCursor(SDL_ENABLE); } @@ -359,6 +359,16 @@ namespace ZL currentLocation->update(delta); } + if (mainMenuTimeout >= 0) + { + mainMenuTimeout -= delta; + if (mainMenuTimeout < 0 && loadingCompleted) + { + menuManager.setupMainMenu(); + } + } + + } } @@ -627,6 +637,12 @@ namespace ZL void Game::handleDown(int64_t fingerId, int mx, int my) { + //if (!loadingCompleted) return; + if (!loadingCompleted) { + std::cout << "[LOADING] Input ignored - loadingCompleted=" << loadingCompleted << std::endl; + return; + } + if (menuManager.getState() == GameState::Gameplay) return; int uiX = mx; int uiY = Environment::projectionHeight - my; @@ -637,6 +653,8 @@ namespace ZL void Game::handleUp(int64_t fingerId, int mx, int my) { + if (!loadingCompleted) return; + if (menuManager.getState() == GameState::Gameplay) return; int uiX = mx; int uiY = Environment::projectionHeight - my; @@ -650,6 +668,8 @@ namespace ZL void Game::handleMotion(int64_t fingerId, int mx, int my) { + if (!loadingCompleted) return; + if (menuManager.getState() == GameState::Gameplay) return; int uiX = mx; int uiY = Environment::projectionHeight - my; diff --git a/src/Game.h b/src/Game.h index c4215af..d9c0d19 100644 --- a/src/Game.h +++ b/src/Game.h @@ -59,6 +59,7 @@ namespace ZL { void updateMusicForLocation(const std::string& locationId); private: + float mainMenuTimeout = 500.f; bool rightMouseDown = false; int lastMouseX = 0; int lastMouseY = 0;