Skip to content

Commit

Permalink
feat(input): Tie the state of the caps lock to the state of fast-forw…
Browse files Browse the repository at this point in the history
…ard if caps lock is used as the fast-forward key (endless-sky#9676)
  • Loading branch information
RisingLeaf authored Jan 20, 2024
1 parent faad248 commit 4ed73dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/_ui/tooltips.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ tip "Toggle fullscreen"
`Toggle whether the game is in fullscreen mode.`

tip "Toggle fast-forward"
`Toggle a 3x speed fast-forward. Fast-forward may be automatically deactivated by the "Interrupt fast-forward" setting.`
`Toggle a 3x speed fast-forward. Fast-forward may be automatically deactivated by the "Interrupt fast-forward" setting. If the key is set to caps-lock then the caps-lock state will be used to determine the fast-forward state.`

tip "Show help"
`Display the help dialogs that are relevant to your current UI panel and situation. Uses the same help dialogs from the "Reactivate first-time help" setting, forcing them to appear even if they have already appeared before.`
Expand Down
8 changes: 7 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,17 @@ void GameLoop(PlayerInfo &player, const Conversation &conversation, const string
// The UI handled the event.
}
else if(event.type == SDL_KEYDOWN && !event.key.repeat
&& (Command(event.key.keysym.sym).Has(Command::FASTFORWARD)))
&& (Command(event.key.keysym.sym).Has(Command::FASTFORWARD))
&& !Command(SDLK_CAPSLOCK).Has(Command::FASTFORWARD))
{
isFastForward = !isFastForward;
}
}

// Special case: If fastforward is on capslock, update on mod state and not
// on keypress.
if(Command(SDLK_CAPSLOCK).Has(Command::FASTFORWARD))
isFastForward = SDL_GetModState() & KMOD_CAPS;
};

// Game loop when running the game normally.
Expand Down

0 comments on commit 4ed73dd

Please sign in to comment.