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

Remove InputStreams using a subtrait of UserInput, allowing users to add their own input kinds #576

Merged
merged 38 commits into from
Aug 7, 2024

Conversation

alice-i-cecile
Copy link
Contributor

@alice-i-cecile alice-i-cecile commented Aug 6, 2024

Fixes #569.

As discussed there, we store all of the UserInput data in a centralized store, and then update these via independent systems.

We can work around the limitations of object safety by moving the required methods out into its own trait, UpdateableInput. Add some system sets, an associated type for the data to access and we're looking good.

Initial progress

Unfortunately, many of our user input types actually represent a configured type: we can't trivially use a single map of "what does the input data look like per type". This crops up in two places:

  1. The virtual axis / virtual dpad types, where the buttonlikes required to be pressed can differ.
  2. The axis / dualaxislike types, which can store input postprocessors.

Our options here are:

  1. Keep the existing design, but make it extensible by taking &World instead of &InputStreams.
  2. Only store raw values in CentralInputStore: chords, dpads and processed axislike data will have to reference this and recompute it.
  3. Add a system per configurable input, using capturing closures and far too much plumbing.

IMO Option 2 is the only viable choice here: 1 imposes too much system ordering pain, and 3 simply won't work very well.

To do

  • remove InputUpdateSystem
  • remove DummyResource
  • update docs on UpdateableUserInput
  • implement UpdateableInput for all of the buttonlikes
  • implement UpdateableInput for all of the non-gamepad dual-axislikes
  • implement UpdateableInput for the gamepad dual-axislikes
  • replace all references to InputStreams with CentralInputStore
  • remove InputStreams
  • figure out how to deal with gamepads
  • update CHANGELOG.md
  • make CI pass

@alice-i-cecile alice-i-cecile added enhancement New feature or request code-quality Make the code faster or prettier labels Aug 6, 2024
@alice-i-cecile alice-i-cecile changed the title Remove InputStreams using a subtrait of UserInput Remove InputStreams using a subtrait of UserInput, allowing users to add their own input kinds Aug 6, 2024
@alice-i-cecile alice-i-cecile marked this pull request as ready for review August 7, 2024 00:28
@alice-i-cecile alice-i-cecile enabled auto-merge (squash) August 7, 2024 17:09
@alice-i-cecile alice-i-cecile merged commit c676e8c into main Aug 7, 2024
4 checks passed
@alice-i-cecile alice-i-cecile deleted the input_streams_yeet branch August 7, 2024 17:51
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove InputStreams struct
1 participant