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

Fix incorrect ActionData::axis_pair value when handling multiple DualAxisData #457

Merged
merged 7 commits into from
Feb 1, 2024

Conversation

Shute052
Copy link
Collaborator

@Shute052 Shute052 commented Jan 30, 2024

Objective

The previous PR (#450) removed the accumulation for ActionData::axis_pair in InputMap::which_pressed(), resulting in a problem where multiple DualAxisData updates would only preserve the last one due to the loss of previously recorded DualAxisData.

A Simple Reproduction Case

InputMap::new([
        (Action, VirtualDPad::arrow_keys()),
        (Action, VirtualDPad::wasd()),
]);

While it functions correctly when pressing WASD, if only the arrow keys were pressed, ActionState::axis_pair() will return None.

Solution

Re-implement the accumulation of ActionData::axis_pair in InputMap::which_pressed().

Changelog

  • Re-add the accumulation of ActionData::axis_pair
  • Simplify the ButtonState::JustPressed check by moving it into the input_pressed checking block and remove the pressed flag

@Shute052 Shute052 changed the title Fix accumulation issue in which_pressed() for ActionData::axis_pair Fix the ActionData::axis_pair value when handling multiple DualAxisData Jan 30, 2024
@Shute052 Shute052 changed the title Fix the ActionData::axis_pair value when handling multiple DualAxisData Fix incorrect ActionData::axis_pair value when handling multiple DualAxisData Jan 30, 2024
@Shute052 Shute052 marked this pull request as ready for review January 30, 2024 22:00
@alice-i-cecile alice-i-cecile added the bug Something isn't working label Jan 30, 2024
@Hellzbellz123
Copy link

this fixes the issue i commented about on discord, glad someone figured out what was actually wrong

@alice-i-cecile alice-i-cecile enabled auto-merge (squash) February 1, 2024 16:09
@alice-i-cecile
Copy link
Contributor

Thank you!

@alice-i-cecile alice-i-cecile merged commit fca2018 into Leafwing-Studios:main Feb 1, 2024
4 checks passed
@Shute052 Shute052 deleted the fix_axis_pair branch February 1, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants