2020-09-18 21:43:47 +00:00
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
2020-10-01 17:54:20 +00:00
|
|
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
2020-09-18 21:43:47 +00:00
|
|
|
pub struct Gamepad(pub usize);
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
2020-10-01 17:54:20 +00:00
|
|
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
2020-09-18 21:43:47 +00:00
|
|
|
pub enum GamepadEventType {
|
|
|
|
Connected,
|
|
|
|
Disconnected,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
2020-10-01 17:54:20 +00:00
|
|
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
2020-09-18 21:43:47 +00:00
|
|
|
pub struct GamepadEvent(pub Gamepad, pub GamepadEventType);
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
2020-10-01 17:54:20 +00:00
|
|
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
2020-09-18 21:43:47 +00:00
|
|
|
pub enum GamepadButtonType {
|
|
|
|
South,
|
|
|
|
East,
|
|
|
|
North,
|
|
|
|
West,
|
|
|
|
C,
|
|
|
|
Z,
|
|
|
|
LeftTrigger,
|
|
|
|
LeftTrigger2,
|
|
|
|
RightTrigger,
|
|
|
|
RightTrigger2,
|
|
|
|
Select,
|
|
|
|
Start,
|
|
|
|
Mode,
|
|
|
|
LeftThumb,
|
|
|
|
RightThumb,
|
|
|
|
DPadUp,
|
|
|
|
DPadDown,
|
|
|
|
DPadLeft,
|
|
|
|
DPadRight,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
2020-10-01 17:54:20 +00:00
|
|
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
2020-09-18 21:43:47 +00:00
|
|
|
pub struct GamepadButton(pub Gamepad, pub GamepadButtonType);
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
2020-10-01 17:54:20 +00:00
|
|
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
2020-09-18 21:43:47 +00:00
|
|
|
pub enum GamepadAxisType {
|
|
|
|
LeftStickX,
|
|
|
|
LeftStickY,
|
|
|
|
LeftZ,
|
|
|
|
RightStickX,
|
|
|
|
RightStickY,
|
|
|
|
RightZ,
|
|
|
|
DPadX,
|
|
|
|
DPadY,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
2020-10-01 17:54:20 +00:00
|
|
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
2020-09-18 21:43:47 +00:00
|
|
|
pub struct GamepadAxis(pub Gamepad, pub GamepadAxisType);
|