Skip to content

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

Merged
alice-i-cecile merged 7 commits into
Leafwing-Studios:mainfrom
Shute052:fix_axis_pair
Feb 1, 2024
Merged

Fix incorrect ActionData::axis_pair value when handling multiple DualAxisData#457
alice-i-cecile merged 7 commits into
Leafwing-Studios:mainfrom
Shute052:fix_axis_pair

Conversation

@Shute052
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Contributor

Thank you!

@alice-i-cecile alice-i-cecile merged commit fca2018 into Leafwing-Studios:main Feb 1, 2024
@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