This commit is contained in:
Vlad 2026-04-19 17:24:37 +06:00
parent 777ee30a24
commit c9324bd30b
2 changed files with 23 additions and 2 deletions

View File

@ -210,7 +210,7 @@ namespace ZL
catch (const std::exception& e) { catch (const std::exception& e) {
std::cerr << "Failed to load UI: " << e.what() << std::endl; std::cerr << "Failed to load UI: " << e.what() << std::endl;
} }
//menuManager.setupMainMenu();
loadingCompleted = true; loadingCompleted = true;
if (audioPlayer->init()) { if (audioPlayer->init()) {
@ -226,7 +226,7 @@ namespace ZL
this->updateMusicForGameState(newState); this->updateMusicForGameState(newState);
}; };
menuManager.setupMainMenu(); //menuManager.setupMainMenu();
SDL_ShowCursor(SDL_ENABLE); SDL_ShowCursor(SDL_ENABLE);
} }
@ -359,6 +359,16 @@ namespace ZL
currentLocation->update(delta); 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) 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 uiX = mx;
int uiY = Environment::projectionHeight - my; int uiY = Environment::projectionHeight - my;
@ -637,6 +653,8 @@ namespace ZL
void Game::handleUp(int64_t fingerId, int mx, int my) void Game::handleUp(int64_t fingerId, int mx, int my)
{ {
if (!loadingCompleted) return;
if (menuManager.getState() == GameState::Gameplay) return;
int uiX = mx; int uiX = mx;
int uiY = Environment::projectionHeight - my; int uiY = Environment::projectionHeight - my;
@ -650,6 +668,8 @@ namespace ZL
void Game::handleMotion(int64_t fingerId, int mx, int my) void Game::handleMotion(int64_t fingerId, int mx, int my)
{ {
if (!loadingCompleted) return;
if (menuManager.getState() == GameState::Gameplay) return;
int uiX = mx; int uiX = mx;
int uiY = Environment::projectionHeight - my; int uiY = Environment::projectionHeight - my;

View File

@ -59,6 +59,7 @@ namespace ZL {
void updateMusicForLocation(const std::string& locationId); void updateMusicForLocation(const std::string& locationId);
private: private:
float mainMenuTimeout = 500.f;
bool rightMouseDown = false; bool rightMouseDown = false;
int lastMouseX = 0; int lastMouseX = 0;
int lastMouseY = 0; int lastMouseY = 0;