pub struct ButtonTracker { /* private fields */ }Expand description
Tracks button state from frame to frame.
Implementations§
Source§impl ButtonTracker
impl ButtonTracker
pub fn new() -> Self
Sourcepub fn frame(&mut self, frame: GamepadButtons)
pub fn frame(&mut self, frame: GamepadButtons)
Set the current frame explicitly.
Sourcepub fn state(&self, player: u8, button: GamepadButton) -> (bool, bool)
pub fn state(&self, player: u8, button: GamepadButton) -> (bool, bool)
Get the state of the previous and current frame, in that order.
pub fn pressed(&self, player: u8, button: GamepadButton) -> bool
pub fn just_pressed(&self, player: u8, button: GamepadButton) -> bool
pub fn just_released(&self, player: u8, button: GamepadButton) -> bool
pub fn held(&self, player: u8, button: GamepadButton) -> bool
Trait Implementations§
Source§impl Clone for ButtonTracker
impl Clone for ButtonTracker
Source§fn clone(&self) -> ButtonTracker
fn clone(&self) -> ButtonTracker
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 moreimpl Copy for ButtonTracker
Source§impl Debug for ButtonTracker
impl Debug for ButtonTracker
Auto Trait Implementations§
impl Freeze for ButtonTracker
impl RefUnwindSafe for ButtonTracker
impl Send for ButtonTracker
impl Sync for ButtonTracker
impl Unpin for ButtonTracker
impl UnsafeUnpin for ButtonTracker
impl UnwindSafe for ButtonTracker
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