#[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: SetButtons currently being pressed
pushed: SetButtons that have just started to be pressed
Meaning they were not pressed last frame, and are now currently pressed
released: SetButtons 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