pub struct GamepadEvent {
pub source: EventSource,
pub control: GamepadControlEvent,
}
Expand description
A gamepad/controller event.
Fields§
§source: EventSource
The client identifier. Also unique per gamepad.
control: GamepadControlEvent
The control-specific info.
Implementations§
Source§impl GamepadEvent
impl GamepadEvent
Sourcepub fn direction(&self) -> Option<Direction>
pub fn direction(&self) -> Option<Direction>
Parses the gamepad event as an arbitrary direction.
Sourcepub fn left_direction(&self) -> Option<Direction>
pub fn left_direction(&self) -> Option<Direction>
The direction if the gamepad event represents a D-pad or left stick. Commonly used e.g. for movement in games.
Sourcepub fn right_direction(&self) -> Option<Direction>
pub fn right_direction(&self) -> Option<Direction>
The direction if the gamepad event represents a right stick event. Commonly used e.g. for camera control in games.
Trait Implementations§
Source§impl Clone for GamepadEvent
impl Clone for GamepadEvent
Source§fn clone(&self) -> GamepadEvent
fn clone(&self) -> GamepadEvent
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for GamepadEvent
impl Debug for GamepadEvent
Source§impl<'de> Deserialize<'de> for GamepadEvent
impl<'de> Deserialize<'de> for GamepadEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for GamepadEvent
impl PartialEq for GamepadEvent
Source§impl Serialize for GamepadEvent
impl Serialize for GamepadEvent
impl StructuralPartialEq for GamepadEvent
Auto Trait Implementations§
impl Freeze for GamepadEvent
impl RefUnwindSafe for GamepadEvent
impl Send for GamepadEvent
impl Sync for GamepadEvent
impl Unpin for GamepadEvent
impl UnwindSafe for GamepadEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more