pub struct Buttons {
pub s: bool,
pub e: bool,
pub w: bool,
pub n: bool,
pub menu: bool,
}
Expand description
State of the buttons.
Fields§
§s: bool
South. The bottom button, like A on the X-Box controller.
Typically used for confirmation, main action, jump, etc.
e: bool
East. The right button, like B on the X-Box controller.
Typically used for cancellation, going to previous screen, etc.
w: bool
West. The left button, like X on the X-Box controller.
Typically used for attack.
n: bool
North. The top button, like Y on the X-Box controller.
Typically used for a secondary action, like charged attack.
The menu button, almost always handled by the runtime.
Implementations§
Source§impl Buttons
impl Buttons
Sourcepub fn just_pressed(&self, old: &Self) -> Self
pub fn just_pressed(&self, old: &Self) -> Self
Given the old state, get buttons that were not pressed but are pressed now.
Sourcepub fn just_released(&self, old: &Self) -> Self
pub fn just_released(&self, old: &Self) -> Self
Given the old state, get buttons that were pressed but aren’t pressed now.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Buttons
impl RefUnwindSafe for Buttons
impl Send for Buttons
impl Sync for Buttons
impl Unpin for Buttons
impl UnwindSafe for Buttons
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