fix menu
This commit is contained in:
parent
777ee30a24
commit
c9324bd30b
24
src/Game.cpp
24
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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user