pub struct GamepadPad {
pub id: u32,
pub name: String,
pub vendor_id: u16,
pub product_id: u16,
pub pressed: HashSet<GamepadButton>,
pub axes: HashMap<GamepadAxis, f32>,
}Expand description
Live state of one connected gamepad, mirrored from GamepadEvents.
A connected gamepad’s polled state, published beside the polled keys and the
mouse levels so a game reads every hardware source from one snapshot.
Fields§
§id: u32Backend-local index, stable for the connection’s lifetime.
name: StringDriver name, as the backend reported it.
vendor_id: u16USB vendor and product ids, 0 where the platform reports none.
product_id: u16§pressed: HashSet<GamepadButton>The standard buttons that are down right now.
axes: HashMap<GamepadAxis, f32>Live axis values, -1.0..=1.0 for sticks and 0.0..=1.0 for triggers.
Implementations§
Source§impl GamepadPad
impl GamepadPad
pub fn axis(&self, axis: GamepadAxis) -> f32
Trait Implementations§
Source§impl Clone for GamepadPad
impl Clone for GamepadPad
Source§fn clone(&self) -> GamepadPad
fn clone(&self) -> GamepadPad
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 GamepadPad
impl Debug for GamepadPad
Source§impl Default for GamepadPad
impl Default for GamepadPad
Source§fn default() -> GamepadPad
fn default() -> GamepadPad
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Forget for GamepadPad
impl Freeze for GamepadPadwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<(GamepadButton, ())>: Freeze,
PhantomData<(GamepadAxis, f32)>: Freeze,
impl Move for GamepadPad
impl RefUnwindSafe for GamepadPad
impl Send for GamepadPad
impl Sync for GamepadPad
impl Unpin for GamepadPad
impl UnsafeUnpin for GamepadPadwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(GamepadButton, ())>: UnsafeUnpin,
PhantomData<(GamepadAxis, f32)>: UnsafeUnpin,
impl UnwindSafe for GamepadPad
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