fixed key binding

This commit is contained in:
2025-08-16 21:15:05 +02:00
parent 6f9ce04708
commit 5ca03fb689

View File

@ -797,6 +797,11 @@ int main(int, char **)
else {
// Route event to state manager handlers for per-state logic
stateMgr.handleEvent(e);
// Keep the local `state` variable in sync with StateManager in case
// a state handler requested a transition (handlers may call
// stateMgr.setState()). Many branches below rely on the local
// `state` variable, so update it immediately after handling.
state = stateMgr.getState();
// Global key toggles (applies regardless of state)
if (e.type == SDL_EVENT_KEY_DOWN && !e.key.repeat) {