pub struct Input { /* private fields */ }Expand description
A fully decoded controller input state for one or more consecutive frames.
Combines the face button state, analog stick position, and D-pad button
from a single encoded input triplet (face + stick + D-pad) into
one convenient struct. The frame_duration field records how many
consecutive frames this exact input state was held.
Implementations§
Source§impl Input
impl Input
Sourcepub fn new(
face_buttons: Vec<FaceButton>,
stick_x: i8,
stick_y: i8,
dpad_button: DPadButton,
frame_duration: u32,
) -> Self
pub fn new( face_buttons: Vec<FaceButton>, stick_x: i8, stick_y: i8, dpad_button: DPadButton, frame_duration: u32, ) -> Self
Creates a new Input from its individual components.
Returns the set of face buttons active during this input state.
Returns the D-pad button held during this input state.
Sourcepub fn frame_duration(&self) -> u32
pub fn frame_duration(&self) -> u32
Returns the number of consecutive frames this input state was held.
Trait Implementations§
impl StructuralPartialEq for Input
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnsafeUnpin for Input
impl UnwindSafe for Input
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