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

Deadzone shapes #370

Merged
merged 13 commits into from
Aug 7, 2023
Merged

Deadzone shapes #370

merged 13 commits into from
Aug 7, 2023

Conversation

100-TomatoJuice
Copy link
Collaborator

@100-TomatoJuice 100-TomatoJuice commented Jul 30, 2023

Currently, the only type of deadzone for a DualAxis is a cross shape. This shape is preferred for some instances, like in Rocket League, as the cross-shape deadzone makes directional flipping easier. However, there are instances where a circular or rectangular deadzone is preferred, like a twin-stick shooter.

Adds DeadzoneShape to DualAxis, which allows the user to choose between a circle, rectangle, and a cross for the deadzone shape.

From manual tests, the shapes appear to be correct and all work. This pr also passed cargo test.

Things to do:

  • Add tests to make sure the deadzones shapes are correct
  • Implement Hash for DeadZoneShape
  • Change tests that relied on Cross snapping
  • Improve documentation of DeadzoneShape (feels a little convoluted)
  • Update RELEASES.md

Questions

  1. Is extract_dual_axis_data() the correct method to test the different shapes?
  2. Adding include_deadzone: bool to input_value() feels a little gross, but I didn't find a better way to get the input_value of a SingleAxis without it running its deadzone. Is there a better, perhaps overlooked, way of doing this?
  3. Currently, the shapes diamensions rely on the x and y thresholds in SingleAxis. This keeps inverting of the input easy, but might create confusion? with_deadzone() has been changed to hopefully make this easy, but there might be a better way.

@alice-i-cecile alice-i-cecile added enhancement New feature or request breaking-change A breaking change that requires a new major version labels Jul 30, 2023
src/axislike.rs Outdated Show resolved Hide resolved
src/axislike.rs Outdated Show resolved Hide resolved
src/axislike.rs Outdated Show resolved Hide resolved
@alice-i-cecile
Copy link
Contributor

WRT question 3, I'm increasingly convinced that we probably don't even want to store a SingleAxis inside of DualAxis: it's overly clever and the abstraction doesn't quite work. @paul-hansen, @Shatur: do either of you have opinions on that (or the rest of this PR)?

@Shatur
Copy link
Collaborator

Shatur commented Jul 30, 2023

Never used this API, so I don't have an opinion on it :(

src/axislike.rs Show resolved Hide resolved
src/axislike.rs Outdated Show resolved Hide resolved
src/axislike.rs Outdated Show resolved Hide resolved
@100-TomatoJuice 100-TomatoJuice marked this pull request as ready for review August 1, 2023 18:13
src/axislike.rs Outdated Show resolved Hide resolved
@paul-hansen paul-hansen mentioned this pull request Aug 4, 2023
20 tasks
@alice-i-cecile alice-i-cecile merged commit 9e27c8c into Leafwing-Studios:main Aug 7, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change A breaking change that requires a new major version enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants