Struct crankit_input::ButtonSet
source · pub struct ButtonSet(/* private fields */);
Expand description
Set of Button
Implementations§
source§impl Set
impl Set
pub fn new() -> Self
pub fn insert(&mut self, button: Button)
sourcepub fn contains_any(self, buttons: impl Into<Self>) -> bool
pub fn contains_any(self, buttons: impl Into<Self>) -> bool
Returns true if the set contains any of the buttons in the other set.
Returns false
if the other set is empty.
sourcepub fn d_pad<T: From<i8>>(self) -> [T; 2]
pub fn d_pad<T: From<i8>>(self) -> [T; 2]
Returns the d-pad buttons contained in this set as a 2d vector
The axes correspond to the playdate screen coordinate system (x
is right, and y
is down):
- Left is [-1, 0]
- Right is [1, 0]
- Down is [0, 1]
- Up is [0, -1]
If more than one D-Pad button is contained in the set, this method returns the sum of the vectors.
Trait Implementations§
source§impl Extend<Button> for Set
impl Extend<Button> for Set
source§fn extend<T: IntoIterator<Item = Button>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Button>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl FromIterator<Button> for Set
impl FromIterator<Button> for Set
impl Copy for Set
impl Eq for Set
impl StructuralEq for Set
impl StructuralPartialEq for Set
Auto Trait Implementations§
impl RefUnwindSafe for Set
impl Send for Set
impl Sync for Set
impl Unpin for Set
impl UnwindSafe for Set
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