pub struct InputState {
pub up: bool,
pub down: bool,
pub left: bool,
pub right: bool,
pub a_button: bool,
pub b_button: bool,
pub start: bool,
pub select: bool,
}Expand description
Input state from the player’s controller.
Fields§
§up: bool§down: bool§left: bool§right: bool§start: bool§select: boolImplementations§
Source§impl InputState
impl InputState
Sourcepub fn direction_pressed(&self) -> Option<Direction>
pub fn direction_pressed(&self) -> Option<Direction>
Get the direction being pressed, if any. Priority matches the original game: Down > Up > Left > Right.
Sourcepub fn to_pad_bits(&self) -> u8
pub fn to_pad_bits(&self) -> u8
Convert to the raw d-pad bitmask used in the original game.
Trait Implementations§
Source§impl Clone for InputState
impl Clone for InputState
Source§fn clone(&self) -> InputState
fn clone(&self) -> InputState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for InputState
Source§impl Debug for InputState
impl Debug for InputState
Source§impl Default for InputState
impl Default for InputState
Source§fn default() -> InputState
fn default() -> InputState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InputState
impl RefUnwindSafe for InputState
impl Send for InputState
impl Sync for InputState
impl Unpin for InputState
impl UnsafeUnpin for InputState
impl UnwindSafe for InputState
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