Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement secondary keybindings #15934

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

y5nw
Copy link
Contributor

@y5nw y5nw commented Mar 23, 2025

Reworked version of #15577, written in a way that reduces conflict with future work (e.g. for keybindings with modifiers). The first few commits are separated into #15933 for easier review.

This PR depends on (and is also rebsaed on top of) #15791.

  • Goal of the PR
    Allows players to define secondary keybindings, e.g. left and right shift for the same action.
  • How does the PR work?
    (See Refactor input handler #15933 for the first few commits.)
    It introduces the syntax of key1|key2, with key1 and key2 being keysyms.
    On top of the first few commits, the event handler is changed to recheck whether an action should be "pressed" or not. (Note that the logic for pressing the key is not short-circuited to set the action - this is helpful for a later PR to implement modifier keys.)
  • Does it resolve any reported issue?
    No.
  • Does this relate to a goal in the roadmap?
    No.
  • If not a bug fix, why is this PR needed? What usecases does it solve?
    E.g. SDL: Use scancodes for keybindings #14964 (comment)

To do

This PR is a Work in Progress.

How to test

Add e.g. keymap_right = SYSTEM_SCANCODE_7|SYSTEM_SCANCODE_9 and observe that both the D and F keys move the player to the right.

@y5nw y5nw added Feature ✨ PRs that add or enhance a feature @ Client / Controls / Input Waiting (on dependency) Waiting on another PR or external circumstances (not for rebases/changes requested) labels Mar 23, 2025
@y5nw y5nw mentioned this pull request Mar 23, 2025
2 tasks
@y5nw y5nw force-pushed the secondary-keybindings-2 branch from d83f156 to 596f89d Compare March 28, 2025 14:10
@y5nw y5nw force-pushed the secondary-keybindings-2 branch 2 times, most recently from 8bc3351 to 79d73dc Compare March 30, 2025 17:02
@y5nw y5nw force-pushed the secondary-keybindings-2 branch from 79d73dc to 52b0f8a Compare March 30, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@ Client / Controls / Input Feature ✨ PRs that add or enhance a feature Waiting (on dependency) Waiting on another PR or external circumstances (not for rebases/changes requested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant