Struct three::controls::Input

source ·
pub struct Input { /* private fields */ }
Expand description

Controls user and system input from keyboard, mouse and system clock.

Implementations

Manually reset current Input state.

Usually there is no need in using this method, because Window resets Input on each update method by default.

It will discard all mouse or raw axes movements and also all keyboard hits. Moreover, delta time will be recalculated.

Get current delta time (time since previous frame) in seconds.

Get list of all keys hit since the last frame.

Get current mouse pointer position in pixels from top-left.

Get current mouse pointer position in Normalized Display Coordinates. See map_to_ndc.

Get list of all mouse wheel movements since last frame.

Get summarized mouse wheel movement (the sum of all movements since last frame).

Get list of all mouse movements since last frame in pixels.

Get list of all mouse movements since last frame in NDC.

Get list of all raw inputs since last frame.

Get summarized mouse movements (the sum of all movements since last frame) in pixels.

Get summarized mouse movements (the sum of all movements since last frame) in NDC.

Get summarized raw input along 0 and 1 axes since last frame. It usually corresponds to mouse movements.

Return whether Window is in focus or not.

Returns true there is any input info from Button, axis::Key or axis::Raw. Otherwise returns false.

Returns the change (‘delta’) in input state since the last call to Window::update.

This value depends on the type of input device is given.

axis::Key

  • None when no updates to the axis are received.
  • Some(1) when only positive input to the axis is received.
  • Some(-1) when only negative input to the axis is received.
  • Some(0) when both positive and negative input to the axis is received.

axis::Raw

  • None when no updates to the axis are received and
  • Some(x) where x is the sum of positive and negative inputs otherwise.

Shortcut for delta * delta_time.

Returns the amount of:

  • Hits for Button as u8.

  • Hits for axis::Key as (u8, u8) where first number is for positive direction and the second one is for negative.

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

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
Sets value as a parameter of self.
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.