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

The main struct of the API. Call update_from_vec or update once per main loop. Then call any of the accessor methods.

Implementations§

Pass every event to this function. WinitInputHelper::Update is easier to use. But this method is useful if you want to inspect the events yourself before giving them to WinitInputHelper. Ensure this method is only called once per application main loop. Ensure every event since the last update_from_vec call is included in the events argument.

Takes every event from the events_loop. If you need to inspect the events yourself use WinitInputHelper::update_from_vec. Ensure this method is only called once per application main loop.

Returns true when the specified keyboard key goes from “not pressed” to “pressed” Otherwise returns false

Returns true when the specified mouse button goes from “not pressed” to “pressed” Otherwise returns false

Left => 0 Right => 1 Middle => 2 Other => 3..255

Returns true when the specified keyboard key goes from “pressed” to “not pressed” Otherwise returns false

Returns true when the specified mouse button goes from “pressed” to “not pressed” Otherwise returns false

Left => 0 Right => 1 Middle => 2 Other => 3..255

Returns true while the specified keyboard key remains “pressed” Otherwise returns false

Returns true while the specified mouse button remains “pressed” Otherwise returns false

Left => 0 Right => 1 Middle => 2 Other => 3..255

Returns true while any shift key is held on the keyboard Otherwise returns false

Returns true while any control key is held on the keyboard Otherwise returns false

Returns true while any alt key is held on the keyboard Otherwise returns false

Returns 0.0 if the mouse is outside of the window. Otherwise returns the amount scrolled by the mouse in between the last two update*() calls

Returns None when the mouse is outside of the window. Otherwise returns the mouse coordinates in pixels

Returns None when the mouse is outside of the window. Otherwise returns the mouse coordinates in the game world.

Returns the difference in mouse coordinates between the last two update*() calls Returns (0.0, 0.0) if the mouse is outside of the window.

Returns the difference in mouse coordinates between the last two update*() calls Returns (0.0, 0.0) if the mouse is outside of the window.

Returns None when the mouse is outside of the window. Otherwise returns the resolution of the window.

Returns the characters pressed since the last update*(). The earlier the character was pressed, the lower the index in the Vec.

Returns the path to a file that has been drag-and-dropped onto the window.

Returns the current window size if it was resized between the last two update*() calls. Otherwise returns None

Returns true if the OS has requested the application to quit. Otherwise returns false.

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 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.