-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - Improve Gamepad DPad Button Detection #5220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much more reasonable behavior, and I really like the improved consistency.
I think this means we need to remove the DPad axis variants on GamepadAxisType
then? It seems like this will cause all dpad presses to be treated as button presses rather than axis events.
This is also good, because then there's exactly one way to handle dpad events.
That's a really good question. We might still need them there? I'm not positive. As far as I can tell from the The gilrs docs say:
So it sounds like there could still be scenarios where a DPad axis might be reported, and that the event conversion is best-effort. |
Hmm. I would personally be in favor of just removing the enum variants proactively and seeing what sort of bug reports we get. Those docs seem like they should be doing basically what we want. If we're still getting problems for users we can try manual deduplication, either in If you / reviewers disagree, please at least leave a warning note on those variants, and point users to the corresponding buttons. |
OK, I'm good with that. If we get a bug report about the buttons not being detected, I think the solution will be to add a mapping to the controller database here and then update gilrs to use it, and that seems like a reasonable workflow. I pushed an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM now :) Make sure to remember to update your PR description!
Enable the `axis_dpad_to_button` gilrs filter to map hats to dpad buttons on supported remotes.
@Shatur I'd like to hear your opinion on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the change is make sense.
Looks like Godot doesn't have DPadX
or DPadY
either: https://docs.godotengine.org/ru/stable/classes/class_%40globalscope.html#enum-globalscope-joysticklist
I don't have experience with gilrs but I personally find using Dpad buttons as independent direction inputs as opposed to mapping them as axes highly preferable. 👍 |
bors r+ |
# Objective - Enable the `axis_dpad_to_button` gilrs filter to map hats to dpad buttons on supported remotes. - Fixes Leafwing-Studios/leafwing-input-manager#149 - Might have fixed the confusion related to #3229 ## Solution - Enables the `axis_dpad_to_button` filter in `gilrs` which will use it's remote mapping information to see if there are hats mapped to dpads for that remote model. I don't really understand the logic it uses exactly, but it is usually enabled by default in gilrs and I believe it probably leads to more intuitive mapping compared to the current situation of dpad buttons being mapped to an axis. - Removes the `GamepadAxisType::DPadX` and `GamepadAxisType::DPadY` enum variants to avoid user confusion. Those variants should never be emitted anyway, for all supported remotes. --- ## Changelog ### Changed - Removed `GamepadAxisType::DPadX` and `GamepadAxisType::DPadY` in favor of using `GamepadButtonType::DPad[Up/Down/Left/Right]` instead. ## Migration Guide If your game reads gamepad events or queries the axis state of `GamePadAxisType::DPadX` or `GamePadAxisType::DPadY`, then you must migrate your code to check whether or not the `GamepadButtonType::DPadUp`, `GamepadButtonType::DPadDown`, etc. buttons were pressed instead.
# Objective - Enable the `axis_dpad_to_button` gilrs filter to map hats to dpad buttons on supported remotes. - Fixes Leafwing-Studios/leafwing-input-manager#149 - Might have fixed the confusion related to bevyengine#3229 ## Solution - Enables the `axis_dpad_to_button` filter in `gilrs` which will use it's remote mapping information to see if there are hats mapped to dpads for that remote model. I don't really understand the logic it uses exactly, but it is usually enabled by default in gilrs and I believe it probably leads to more intuitive mapping compared to the current situation of dpad buttons being mapped to an axis. - Removes the `GamepadAxisType::DPadX` and `GamepadAxisType::DPadY` enum variants to avoid user confusion. Those variants should never be emitted anyway, for all supported remotes. --- ## Changelog ### Changed - Removed `GamepadAxisType::DPadX` and `GamepadAxisType::DPadY` in favor of using `GamepadButtonType::DPad[Up/Down/Left/Right]` instead. ## Migration Guide If your game reads gamepad events or queries the axis state of `GamePadAxisType::DPadX` or `GamePadAxisType::DPadY`, then you must migrate your code to check whether or not the `GamepadButtonType::DPadUp`, `GamepadButtonType::DPadDown`, etc. buttons were pressed instead.
# Objective - Enable the `axis_dpad_to_button` gilrs filter to map hats to dpad buttons on supported remotes. - Fixes Leafwing-Studios/leafwing-input-manager#149 - Might have fixed the confusion related to bevyengine#3229 ## Solution - Enables the `axis_dpad_to_button` filter in `gilrs` which will use it's remote mapping information to see if there are hats mapped to dpads for that remote model. I don't really understand the logic it uses exactly, but it is usually enabled by default in gilrs and I believe it probably leads to more intuitive mapping compared to the current situation of dpad buttons being mapped to an axis. - Removes the `GamepadAxisType::DPadX` and `GamepadAxisType::DPadY` enum variants to avoid user confusion. Those variants should never be emitted anyway, for all supported remotes. --- ## Changelog ### Changed - Removed `GamepadAxisType::DPadX` and `GamepadAxisType::DPadY` in favor of using `GamepadButtonType::DPad[Up/Down/Left/Right]` instead. ## Migration Guide If your game reads gamepad events or queries the axis state of `GamePadAxisType::DPadX` or `GamePadAxisType::DPadY`, then you must migrate your code to check whether or not the `GamepadButtonType::DPadUp`, `GamepadButtonType::DPadDown`, etc. buttons were pressed instead.
# Objective - Enable the `axis_dpad_to_button` gilrs filter to map hats to dpad buttons on supported remotes. - Fixes Leafwing-Studios/leafwing-input-manager#149 - Might have fixed the confusion related to bevyengine#3229 ## Solution - Enables the `axis_dpad_to_button` filter in `gilrs` which will use it's remote mapping information to see if there are hats mapped to dpads for that remote model. I don't really understand the logic it uses exactly, but it is usually enabled by default in gilrs and I believe it probably leads to more intuitive mapping compared to the current situation of dpad buttons being mapped to an axis. - Removes the `GamepadAxisType::DPadX` and `GamepadAxisType::DPadY` enum variants to avoid user confusion. Those variants should never be emitted anyway, for all supported remotes. --- ## Changelog ### Changed - Removed `GamepadAxisType::DPadX` and `GamepadAxisType::DPadY` in favor of using `GamepadButtonType::DPad[Up/Down/Left/Right]` instead. ## Migration Guide If your game reads gamepad events or queries the axis state of `GamePadAxisType::DPadX` or `GamePadAxisType::DPadY`, then you must migrate your code to check whether or not the `GamepadButtonType::DPadUp`, `GamepadButtonType::DPadDown`, etc. buttons were pressed instead.
Objective
axis_dpad_to_button
gilrs filter to map hats to dpad buttons on supported remotes.Solution
axis_dpad_to_button
filter ingilrs
which will use it's remote mapping information to see if there are hats mapped to dpads for that remote model. I don't really understand the logic it uses exactly, but it is usually enabled by default in gilrs and I believe it probably leads to more intuitive mapping compared to the current situation of dpad buttons being mapped to an axis.GamepadAxisType::DPadX
andGamepadAxisType::DPadY
enum variants to avoid user confusion. Those variants should never be emitted anyway, for all supported remotes.Changelog
Changed
GamepadAxisType::DPadX
andGamepadAxisType::DPadY
in favor of usingGamepadButtonType::DPad[Up/Down/Left/Right]
instead.Migration Guide
If your game reads gamepad events or queries the axis state of
GamePadAxisType::DPadX
orGamePadAxisType::DPadY
, then you must migrate your code to check whether or not theGamepadButtonType::DPadUp
,GamepadButtonType::DPadDown
, etc. buttons were pressed instead.