pub struct InputHandler<AX, AC>where
    AX: Hash + Eq,
    AC: Hash + Eq,
{ pub bindings: Bindings<AX, AC>, /* private fields */ }
Expand description

This struct holds state information about input devices.

For example, if a key is pressed on the keyboard, this struct will record that the key is pressed until it is released again.

Fields

bindings: Bindings<AX, AC>

Maps inputs to actions and axes.

Implementations

Creates a new input handler.

Updates the input handler with a new engine event.

The Amethyst game engine will automatically call this if the InputHandler is attached to the world as a resource with id 0.

Updates the input handler with a new controller event.

Called internally from SdlEventsSystem when using sdl_controller feature. You should invoke it in your system if you provide your own controller input implementation.

Returns an iterator over all keys that are down.

Checks if a key is down.

Returns an iterator over all pressed mouse buttons

Checks if a mouse button is down.

Returns an iterator over all pressed scan codes

Checks if the key corresponding to a scan code is down.

Returns an iterator over all pressed controller buttons on all controllers.

Checks if a controller button is down on specific controller.

List controller ids of all currently connected controllers. IDs are assigned sequentially in the order of connection starting from 0, always taking the lowest next free number.

Returns true if a controller with the given id is connected.

Gets the current mouse position.

this method can return None, either if no mouse is connected, or if no mouse events have been recorded

Returns an iterator over all buttons that are down.

Checks if a button is down.

Returns the value of an axis by the string id, if the id doesn’t exist this returns None.

Returns true if any of the action keys are down.

Trait Implementations

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Tries to create the default.
Calls try_default and panics on an error case.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.