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

Refactor UserInput into Buttonlike, Axislike and DualAxislike #548

Merged
merged 98 commits into from
Jul 18, 2024

Conversation

alice-i-cecile
Copy link
Contributor

@alice-i-cecile alice-i-cecile commented Jun 22, 2024

Fixes #535.

This is a major refactor that splits user inputs into three kinds: buttonlike, axislike and dualaxislike.
This change ends up rippling through the whole stack: from Actionlike to UserInput to InputMap to ActionState.

Despite that, I'm really happy with this change! It really clarifies the semantics of the different input types, in a way that I think will be easier to learn, more natural to maintain and harder to mess up.

There are a number of items that need to be done before this is mergeable still:

  • rename with_dualaxis to with_dual_axis
  • generate ActionDiffs correctly
  • sanity-check clashing inputs
  • actually update axislike and dualaxislike data in ActionState::update's call stack
  • fix the lengths of all of our different user input kinds
  • go over ActionState to double-check that all APIs have been updated correctly
  • make everything compile
  • cargo fmt
  • cargo clippy
  • get tests passing 🥲

Follow-up

This PR is already way, way too big. In the interest of sanity, some functionality has been omitted / left broken in this PR.

  • store 0-1 values in Buttonlike inputs to properly handle triggers
  • fix clash handling for dpads
  • fix action diffing

@alice-i-cecile alice-i-cecile enabled auto-merge (squash) July 18, 2024 20:59
@alice-i-cecile alice-i-cecile merged commit 5e90a7d into main Jul 18, 2024
4 checks passed
@alice-i-cecile alice-i-cecile deleted the input-trait-split branch July 18, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality Make the code faster or prettier controversial Requires a heightened standard of review usability Reduce user friction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split UserInput into multiple traits
2 participants