Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows players to define secondary keybindings, e.g. using left or right shift for sneaking in the SDL build.
This PR depends on #15152.
Note that this PR had some minor conflicts with #14964. IMO we should merge that PR first and then this one.
Allow defining secondary keybindings (see description above).
std::vector<KeyPress>
. This allows keeping an order for keypresses (e.g. when saving the settings); it should not be problematic in terms of performance as the list of keybindings for a single setting will likely be very short (containing at most 2 entries) in most real-world cases.|
character. It is not possible to escape|
. This keep things simple at the cost of not allowing the|
key in a key list if the key cannot be represented with aEKEY_CODE
, but it should not be problematic as SDL: Use scancodes for keybindings #14964 implements a new keycode syntax that is used by default (and does not involve the|
character). Note that a special case is created if the setting string includes only the|
character, in which case it is parsed as a key instead of a list of keys.No.
No.
SDL: Use scancodes for keybindings #14964 (comment)
To do
This PR is a Work in Progress.
How to test
Change a key setting to have the form of (e.g.)
KEY_KEY_Z|KEY_KEY_Y
and observe that pressing (in this case) theZ
orY
key performs the relevant action. Note that it is currently not possible to specify secondary keybindings in the "Controls" form/GUI (see To-Do).