Struct crankit_input::ButtonsState
source · #[non_exhaustive]pub struct ButtonsState {
pub current: Set,
pub pushed: Set,
pub released: Set,
}
Expand description
State of the playdate buttons
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.current: Set
Buttons currently being pressed
pushed: Set
Buttons that have just started to be pressed
Meaning they were not pressed last frame, and are now currently pressed
released: Set
Buttons that have just been released
Meaning they were pressed last frame, and are no longer pressed
Implementations§
source§impl State
impl State
sourcepub fn is_pressed(self, button: Button) -> bool
pub fn is_pressed(self, button: Button) -> bool
Returns true if the given button is currently pressed
sourcepub fn is_just_pressed(self, button: Button) -> bool
pub fn is_just_pressed(self, button: Button) -> bool
Returns true if the given button is has just started to be pressed
Meaning it was not pressed last frame, and is now currently pressed
sourcepub fn is_just_released(self, button: Button) -> bool
pub fn is_just_released(self, button: Button) -> bool
Returns true if the given button is has just started to be pressed
Meaning it was pressed last frame, and is no longer pressed
sourcepub fn is_any_pressed(&self, buttons: Set) -> bool
pub fn is_any_pressed(&self, buttons: Set) -> bool
Returns true if any of the given button is currently pressed
sourcepub fn is_any_just_pressed(&self, buttons: Set) -> bool
pub fn is_any_just_pressed(&self, buttons: Set) -> bool
Returns true if any of the given button was just pressed
sourcepub fn is_any_just_released(&self, buttons: Set) -> bool
pub fn is_any_just_released(&self, buttons: Set) -> bool
Returns true if any of the given button was just released
sourcepub fn d_pad<T: From<i8>>(self) -> [T; 2]
pub fn d_pad<T: From<i8>>(self) -> [T; 2]
Returns the currently pressed state of the d-pad as a 2d vector
See Self::d_pad
for more details
sourcepub fn d_pad_just_pressed<T: From<i8>>(self) -> [T; 2]
pub fn d_pad_just_pressed<T: From<i8>>(self) -> [T; 2]
Returns the buttons of the d-pad that have just started to be pressed as a 2d vector
See Self::d_pad
for more details
sourcepub fn d_pad_just_released<T: From<i8>>(self) -> [T; 2]
pub fn d_pad_just_released<T: From<i8>>(self) -> [T; 2]
Returns the buttons of the d-pad that have just been released as a 2d vector
See Self::d_pad
for more details