pub struct PadState {
pub buttons: ButtonSet,
pub left_stick: (f32, f32),
pub right_stick: (f32, f32),
}Expand description
One pad’s raw state in one frame, as the platform reports it.
Fields§
The real buttons held, by where they physically are on the pad (the stick directions come from the sticks below).
left_stick: (f32, f32)The left stick as (x, y), each from -1 to 1: +x is right, +y
is down.
right_stick: (f32, f32)The right stick, like left_stick.
Implementations§
Source§impl PadState
impl PadState
Sourcepub fn from_standard(buttons: u32, axes: [f32; 4]) -> Self
pub fn from_standard(buttons: u32, axes: [f32; 4]) -> Self
A pad the browser reports in the Gamepad API’s “standard” mapping:
bit i of buttons is set while its buttons[i] is pressed (only
the first 16 count), and axes are its first four axes (left stick
x, y, right stick x, y; down is positive).
Trait Implementations§
impl Copy for PadState
impl StructuralPartialEq for PadState
Auto Trait Implementations§
impl Freeze for PadState
impl RefUnwindSafe for PadState
impl Send for PadState
impl Sync for PadState
impl Unpin for PadState
impl UnsafeUnpin for PadState
impl UnwindSafe for PadState
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