pub struct GamepadState { /* private fields */ }Expand description
Per-frame and steady-state data for a single gamepad index.
The edge sets follow the same contract as InputState:
buttons_pressed records a button that went down on the frame it
went down and is cleared by GamepadState::end_frame,
buttons_held records every button currently down and survives
end_frame, and buttons_released records a button that was held
and came up on this frame.
Implementations§
Source§impl GamepadState
Implements the per-pad query surface on GamepadState.
impl GamepadState
Implements the per-pad query surface on GamepadState.
Sourcepub fn axis_pressed(&self, axis: u32, threshold: f64) -> bool
pub fn axis_pressed(&self, axis: u32, threshold: f64) -> bool
Sourcepub fn end_frame(&mut self)
pub fn end_frame(&mut self)
Clears this frame’s per-frame data, keeping the held set.
Mirrors InputState::end_frame: the pressed and released
sets are per-frame and are dropped, while the held set survives
so a button that is still down stays held on the next frame.
Source§impl GamepadState
impl GamepadState
pub fn get_id(&self) -> String
pub fn get_mut_id(&mut self) -> &mut String
pub fn set_id(&mut self, val: String) -> &mut Self
pub fn get_axes(&self) -> &Vec<f64>
pub fn set_axes(&mut self, val: Vec<f64>) -> &mut Self
pub fn get_connected(&self) -> bool
pub fn get_mut_connected(&mut self) -> &mut bool
pub fn set_connected(&mut self, val: bool) -> &mut Self
Trait Implementations§
Source§impl Clone for GamepadState
impl Clone for GamepadState
Source§impl Debug for GamepadState
impl Debug for GamepadState
Source§impl Default for GamepadState
impl Default for GamepadState
Source§impl PartialEq for GamepadState
impl PartialEq for GamepadState
impl StructuralPartialEq for GamepadState
Auto Trait Implementations§
impl Freeze for GamepadState
impl RefUnwindSafe for GamepadState
impl Send for GamepadState
impl Sync for GamepadState
impl Unpin for GamepadState
impl UnsafeUnpin for GamepadState
impl UnwindSafe for GamepadState
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