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
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§impl Debug for GamepadPad
impl Debug for GamepadPad
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