fix
This commit is contained in:
24
src/main.cpp
24
src/main.cpp
@ -849,7 +849,9 @@ int main(int, char **)
|
||||
Settings::instance().setSoundEnabled(SoundEffectManager::instance().isEnabled());
|
||||
}
|
||||
// Help overlay toggle: F1 (keep it disabled on Loading/Menu)
|
||||
if (e.key.scancode == SDL_SCANCODE_F1 && state != AppState::Loading && state != AppState::Menu)
|
||||
const bool helpToggleKey =
|
||||
(e.key.scancode == SDL_SCANCODE_F1 && state != AppState::Loading && state != AppState::Menu);
|
||||
if (helpToggleKey)
|
||||
{
|
||||
showHelpOverlay = !showHelpOverlay;
|
||||
if (state == AppState::Playing) {
|
||||
@ -868,24 +870,14 @@ int main(int, char **)
|
||||
helpOverlayPausedGame = false;
|
||||
}
|
||||
}
|
||||
// If help overlay is visible and the user presses ESC, close help and return to Menu
|
||||
// If help overlay is visible and the user presses ESC, close help.
|
||||
if (e.key.scancode == SDL_SCANCODE_ESCAPE && showHelpOverlay) {
|
||||
showHelpOverlay = false;
|
||||
// Unpause only if the overlay paused the game.
|
||||
if (state == AppState::Playing && helpOverlayPausedGame) {
|
||||
game.setPaused(false);
|
||||
}
|
||||
helpOverlayPausedGame = false;
|
||||
// Unpause game if we paused it for the overlay
|
||||
if (state == AppState::Playing) {
|
||||
if (game.isPaused() && !helpOverlayPausedGame) {
|
||||
// If paused for other reasons, avoid overriding; otherwise ensure unpaused
|
||||
// (The flag helps detect pause because of help overlay.)
|
||||
}
|
||||
}
|
||||
if (state != AppState::Menu && ctx.requestFadeTransition) {
|
||||
// Request a transition back to the Menu state
|
||||
ctx.requestFadeTransition(AppState::Menu);
|
||||
} else if (state != AppState::Menu && ctx.stateManager) {
|
||||
state = AppState::Menu;
|
||||
ctx.stateManager->setState(state);
|
||||
}
|
||||
}
|
||||
if (e.key.key == SDLK_F11 || (e.key.key == SDLK_RETURN && (e.key.mod & SDL_KMOD_ALT)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user