pub struct DPad {
pub state: u16,
pub previous: u16,
}Expand description
A simple virtual Game controller with only digital buttons.
Fields§
§state: u16§previous: u16Implementations§
Source§impl DPad
impl DPad
pub fn new() -> Self
Sourcepub fn copy_current_to_previous_state(&mut self)
pub fn copy_current_to_previous_state(&mut self)
Must be called once per frame, prior to setting any value for the current state.
Sourcepub fn is_just_pressed(&self, button: Button) -> bool
pub fn is_just_pressed(&self, button: Button) -> bool
Whether the given button has just been pressed this frame. Requires [copy_current_to_previous_state] to have been called at the beginning of the frame
Sourcepub fn is_just_released(&self, button: Button) -> bool
pub fn is_just_released(&self, button: Button) -> bool
Whether the given button has just been released this frame. Requires [copy_current_to_previous_state] to have been called at the beginning of the frame
Trait Implementations§
impl Copy for DPad
impl StructuralPartialEq for DPad
Auto Trait Implementations§
impl Freeze for DPad
impl RefUnwindSafe for DPad
impl Send for DPad
impl Sync for DPad
impl Unpin for DPad
impl UnwindSafe for DPad
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