Struct ark_api::applet::input::InputManager
source · pub struct InputManager { /* private fields */ }Expand description
Use this in your module to help with input filtering and tracking.
Implementations§
source§impl InputManager
impl InputManager
sourcepub fn events(&self) -> impl Iterator<Item = &(State, Event)>
pub fn events(&self) -> impl Iterator<Item = &(State, Event)>
Events that came in during the last call to update.
Each event comes with a State which can be used to check
e.g. modifier keys and mouse position at the time of the event.
Gamepad buttons that are currently down.
sourcepub fn is_key_down(&self, key: Key) -> bool
pub fn is_key_down(&self, key: Key) -> bool
Is the key currently down?
Is the gamepad button currently down?
sourcepub fn was_key_pressed(&self, modifiers: Modifiers, key_needle: Key) -> bool
pub fn was_key_pressed(&self, modifiers: Modifiers, key_needle: Key) -> bool
Did the key go from not down to down in this frame?
Also filters on modifies so you can check for e.g. Cmd + Key::U.
sourcepub fn was_command_made(&self, command_needle: Command) -> bool
pub fn was_command_made(&self, command_needle: Command) -> bool
Was e.g. Command::Paste issued this frame?
sourcepub fn update(&mut self, applet: &Applet)
pub fn update(&mut self, applet: &Applet)
Call this or Self::update_for_player once at the start of each frame.
sourcepub fn update_for_player(&mut self, applet: &Applet, player_id: u64)
pub fn update_for_player(&mut self, applet: &Applet, player_id: u64)
Call this or Self::update once at the start of each frame.
Trait Implementations§
source§impl Clone for InputManager
impl Clone for InputManager
source§fn clone(&self) -> InputManager
fn clone(&self) -> InputManager
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for InputManager
impl Debug for InputManager
source§impl Default for InputManager
impl Default for InputManager
source§fn default() -> InputManager
fn default() -> InputManager
Returns the “default value” for a type. Read more
source§impl PartialEq<InputManager> for InputManager
impl PartialEq<InputManager> for InputManager
source§fn eq(&self, other: &InputManager) -> bool
fn eq(&self, other: &InputManager) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl StructuralPartialEq for InputManager
Auto Trait Implementations§
impl RefUnwindSafe for InputManager
impl Send for InputManager
impl Sync for InputManager
impl Unpin for InputManager
impl UnwindSafe for InputManager
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