pub struct Buttons {
    pub current: PDButtons,
    pub pushed: PDButtons,
    pub released: PDButtons,
}
Expand description

Wrapped Buttons API.

Represents buttons state.

  • current indicates which buttons are currently down.
  • pushed and released reflects which buttons were pushed or released over the previous update cycle.

Note: at the nominal frame rate of 50 ms, fast button presses can be missed if you just poll the instantaneous state.

Fields§

§current: PDButtons

Indicating which buttons are currently down.

§pushed: PDButtons

Reflect which buttons were pushed over the previous update cycle. See struct doc.

§released: PDButtons

Reflect which buttons were released over the previous update cycle. See struct doc.

Implementations§

source§

impl Buttons

source

pub fn get() -> Option<Self>

source

pub fn get_to( current: &mut PDButtons, pushed: &mut PDButtons, released: &mut PDButtons ) -> Option<()>

source

pub fn get_current() -> Option<PDButtons>

Uses getButtonState.

Requests & returns only current part of state, see Self::current

source

pub fn get_pushed() -> Option<PDButtons>

Uses getButtonState.

Requests & returns only current part of state, see Self::pushed

source

pub fn get_released() -> Option<PDButtons>

Uses getButtonState.

Requests & returns only current part of state, see Self::released

Trait Implementations§

source§

impl Debug for Buttons

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Buttons

§

impl Send for Buttons

§

impl Sync for Buttons

§

impl Unpin for Buttons

§

impl UnwindSafe for Buttons

Blanket Implementations§

§

impl<T> Any for Twhere T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for Twhere T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for Twhere U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 3 bytes