mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
Support for additional gamepad buttons and axis (#5853)
# 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.
This commit is contained in:
parent
f9853cbbc2
commit
79e7c93060
1 changed files with 6 additions and 0 deletions
|
@ -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).
|
||||
Other(u8),
|
||||
}
|
||||
|
||||
/// A button of a [`Gamepad`].
|
||||
|
@ -341,6 +344,9 @@ pub enum GamepadAxisType {
|
|||
RightStickY,
|
||||
/// The value of the right `Z` button.
|
||||
RightZ,
|
||||
|
||||
/// Non-standard support for other axis types (i.e. HOTAS sliders, potentiometers, etc).
|
||||
Other(u8),
|
||||
}
|
||||
|
||||
/// An axis of a [`Gamepad`].
|
||||
|
|
Loading…
Reference in a new issue