pub struct InputManager { /* private fields */ }
Expand description

Use this in your module to help with input filtering and tracking.

Implementations§

source§

impl InputManager

source

pub fn state(&self) -> State

Current state of modifier keys etc.

source

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.

source

pub fn down_keys(&self) -> impl Iterator<Item = &Key> + '_

Keys that are currently down.

source

pub fn down_gamepad_buttons(&self) -> impl Iterator<Item = &GamepadButton> + '_

Gamepad buttons that are currently down.

source

pub fn is_key_down(&self, key: Key) -> bool

Is the key currently down?

source

pub fn is_gamepad_button_down(&self, button: GamepadButton) -> bool

Is the gamepad button currently down?

source

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.

source

pub fn was_command_made(&self, command_needle: Command) -> bool

Was e.g. Command::Paste issued this frame?

source

pub fn update(&mut self, applet: &Applet)

Call this or Self::update_for_player once at the start of each frame.

source

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

source§

fn clone(&self) -> InputManager

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for InputManager

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for InputManager

source§

fn default() -> InputManager

Returns the “default value” for a type. Read more
source§

impl PartialEq<InputManager> for InputManager

source§

fn eq(&self, other: &InputManager) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for InputManager

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.