-
-
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] - Support for additional gamepad buttons and axis #5853
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.
Change looks good a priori, but I'd like @alice-i-cecile to have a look with the leafwing-input-manager experience, see if we're not missing anything by adding those extra buttons that way. Like, if we just add enum values but never use them in any built-in Bevy input system, who's going to use them? I assume the inputs gathered by Bevy internally will never return those new values. So how are those new buttons and axes ever triggered?
crates/bevy_input/src/gamepad.rs
Outdated
@@ -276,6 +276,9 @@ pub enum GamepadButtonType { | |||
DPadLeft, | |||
/// The right button of the D-Pad. | |||
DPadRight, | |||
|
|||
/// Miscellaneous buttons, considered non-standard (i.e. Extra buttons on a flight stick that do not have a gamepad equivalent). | |||
Button(u8), |
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.
Why not name that one Other
like the axis one? It's a little confusing, as the other values in the enum are also buttons.
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.
if that makes more sense then that's totally fine, will switch it over.
My view is that this will be triggered a) synthetically or b) via This PR's approach should work seamlessly on the Alternatively, it may end up being correct to provide a collection of traits and let crates like |
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.
Once Button
-> Other
has been changed, this LGTM and can be merged.
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.
bors r+
# Objective Extend the scope of Gamepad to accommodate devices that have more inputs than a typical controller. ## Solution Add additional enum variants to both _GamepadButtonType_ and _GamepadAxisType_ that supports up to 255 more non-standard buttons/axis respectively. ## Personal motivation I have been writing an alternative to the GILRS crate, and with this simple change to the source code, It will be a trivial thing to direct new devices through the bevy systems, even when they do not always behave exactly like your typical controller.
Pull request successfully merged into main. Build succeeded: |
Ok thanks for the feedback @alice-i-cecile 👍 |
# Objective Extend the scope of Gamepad to accommodate devices that have more inputs than a typical controller. ## Solution Add additional enum variants to both _GamepadButtonType_ and _GamepadAxisType_ that supports up to 255 more non-standard buttons/axis respectively. ## Personal motivation I have been writing an alternative to the GILRS crate, and with this simple change to the source code, It will be a trivial thing to direct new devices through the bevy systems, even when they do not always behave exactly like your typical controller.
# Objective Extend the scope of Gamepad to accommodate devices that have more inputs than a typical controller. ## Solution Add additional enum variants to both _GamepadButtonType_ and _GamepadAxisType_ that supports up to 255 more non-standard buttons/axis respectively. ## Personal motivation I have been writing an alternative to the GILRS crate, and with this simple change to the source code, It will be a trivial thing to direct new devices through the bevy systems, even when they do not always behave exactly like your typical controller.
Objective
Extend the scope of Gamepad to accommodate devices that have more inputs than a typical controller.
Solution
Add additional enum variants to both GamepadButtonType and GamepadAxisType that supports up to 255 more non-standard buttons/axis respectively.
Personal motivation
I have been writing an alternative to the GILRS crate, and with this simple change to the source code, It will be a trivial thing to direct new devices through the bevy systems, even when they do not always behave exactly like your typical controller.