Repository navigation
tecs.controller: read a controller's mapping back and report its conflicts - #18
Open
albanmgicquel wants to merge 1 commit into
Open
albanmgicquel wants to merge 1 commit into
albanmgicquel wants to merge 1 commit into
Conversation
A controls screen shows what each action is bound to, lets a player change it, and warns when two actions share an input. getActions returns the action names sorted, getBindings a copy of one action's list, and getConflicts the pairs of actions one key, mouse button, gamepad button or overlapping axis triggers together. Conflicts are reported rather than refused, since a player mid-edit holds one for a moment.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A controls screen has to show what each action is bound to, and warn when two actions share an input. This adds three read-only queries to
Controller.Changes
getActions()returns the mapping's action names, sorted.getBindings(action)returns a copy of one action's binding strings in declaration order, or an empty list for an unknown action.getConflicts()returns every pair of actions that one physical input triggers together, asConflictrecords (first,second,binding), sorted by first action and then second. Keys, mouse buttons and gamepad buttons overlap when they name the same control. Axis bindings overlap on the same axis unless they read opposite halves. Conflicts are reported, never refused, since a player editing their bindings holds one for a moment. Two controllers never conflict, so a game that switches mappings for a menu checks each mapping on its own.Conflictis listed in the API page.Tests
nupp checkandnupp task format-checkare clean,nupp testpasses all 1,059 tests in 88 suites, andtest-toolspasses 10.verify(ex-hostthroughex-shapes, 5 frames each) exit 0.docs-checkdoesn't run in my local setup: it stops on a missinglunamarkrock in the Nupp checkout, andmainstops there too. The Rust gates weren't run, since this PR changes no Rust.