This commit is contained in:
2025-12-19 16:48:26 +01:00
parent 989b98002c
commit fe0cd289e2
3 changed files with 34 additions and 20 deletions

View File

@ -328,6 +328,26 @@ bool ApplicationManager::initializeManagers() {
// Global hotkeys (handled across all states)
if (pressed) {
// While the help overlay is visible, swallow input so gameplay/menu doesn't react.
// Allow only help-toggle/close keys to pass through this global handler.
if (m_showHelpOverlay) {
if (sc == SDL_SCANCODE_ESCAPE) {
m_showHelpOverlay = false;
if (m_helpOverlayPausedGame && m_game) {
m_game->setPaused(false);
}
m_helpOverlayPausedGame = false;
} else if (sc == SDL_SCANCODE_F1) {
// Toggle off
m_showHelpOverlay = false;
if (m_helpOverlayPausedGame && m_game) {
m_game->setPaused(false);
}
m_helpOverlayPausedGame = false;
}
consume = true;
}
// Toggle fullscreen on F, F11 or Alt+Enter (or Alt+KP_Enter)
if (sc == SDL_SCANCODE_F || sc == SDL_SCANCODE_F11 ||
((sc == SDL_SCANCODE_RETURN || sc == SDL_SCANCODE_RETURN2 || sc == SDL_SCANCODE_KP_ENTER) &&
@ -362,8 +382,9 @@ bool ApplicationManager::initializeManagers() {
consume = true;
}
if (!consume && sc == SDL_SCANCODE_F1) {
if (!consume && (sc == SDL_SCANCODE_F1)) {
AppState currentState = m_stateManager ? m_stateManager->getState() : AppState::Loading;
// F1 is global (except Loading).
if (currentState != AppState::Loading) {
m_showHelpOverlay = !m_showHelpOverlay;
if (currentState == AppState::Playing && m_game) {