Struct gilrs::ev::state::GamepadState
source · pub struct GamepadState {
buttons: FnvHashMap<Code, ButtonData>,
axes: FnvHashMap<Code, AxisData>,
}
Expand description
Cached gamepad state.
Fields§
§axes: FnvHashMap<Code, AxisData>
Implementations§
source§impl GamepadState
impl GamepadState
pub(crate) fn new() -> Self
sourcepub fn is_pressed(&self, btn: Code) -> bool
pub fn is_pressed(&self, btn: Code) -> bool
Returns true
if given button is pressed. Returns false
if there is no information about
btn
or it is not pressed.
sourcepub fn value(&self, el: Code) -> f32
pub fn value(&self, el: Code) -> f32
Returns value of el
or 0.0 when there is no information about it. el
can be either axis
or button.
Iterate over buttons data.
sourcepub fn axes(&self) -> AxisDataIter<'_> ⓘ
pub fn axes(&self) -> AxisDataIter<'_> ⓘ
Iterate over axes data.
Returns button state and when it changed.
sourcepub fn axis_data(&self, axis: Code) -> Option<&AxisData>
pub fn axis_data(&self, axis: Code) -> Option<&AxisData>
Returns axis state and when it changed.
pub(crate) fn set_btn_pressed( &mut self, btn: Code, pressed: bool, counter: u64, timestamp: SystemTime, )
pub(crate) fn set_btn_repeating( &mut self, btn: Code, counter: u64, timestamp: SystemTime, )
pub(crate) fn set_btn_value( &mut self, btn: Code, value: f32, counter: u64, timestamp: SystemTime, )
pub(crate) fn update_axis(&mut self, axis: Code, data: AxisData)
Trait Implementations§
source§impl Clone for GamepadState
impl Clone for GamepadState
source§fn clone(&self) -> GamepadState
fn clone(&self) -> GamepadState
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 moreAuto Trait Implementations§
impl Freeze for GamepadState
impl RefUnwindSafe for GamepadState
impl Send for GamepadState
impl Sync for GamepadState
impl Unpin 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