pub struct InputManager { /* private fields */ }
Expand description
Use this in your module to help with input filtering and tracking.
Implementations
sourceimpl 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
sourceimpl Clone for InputManager
impl Clone for InputManager
sourcefn clone(&self) -> InputManager
fn clone(&self) -> InputManager
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for InputManager
impl Debug for InputManager
sourceimpl Default for InputManager
impl Default for InputManager
sourcefn default() -> InputManager
fn default() -> InputManager
Returns the “default value” for a type. Read more
sourceimpl PartialEq<InputManager> for InputManager
impl PartialEq<InputManager> for InputManager
sourcefn 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 ==
. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more