pub struct Input { /* private fields */ }
Expand description
Controls user and system input from keyboard, mouse and system clock.
Implementations
sourceimpl Input
impl Input
sourcepub fn delta_time(&self) -> f32
pub fn delta_time(&self) -> f32
Get current delta time (time since previous frame) in seconds.
sourcepub fn mouse_pos(&self) -> Point2<f32>
pub fn mouse_pos(&self) -> Point2<f32>
Get current mouse pointer position in pixels from top-left.
sourcepub fn mouse_pos_ndc(&self) -> Point2<f32>
pub fn mouse_pos_ndc(&self) -> Point2<f32>
Get current mouse pointer position in Normalized Display Coordinates.
See map_to_ndc
.
sourcepub fn mouse_wheel_movements(&self) -> &[f32]
pub fn mouse_wheel_movements(&self) -> &[f32]
Get list of all mouse wheel movements since last frame.
sourcepub fn mouse_wheel(&self) -> f32
pub fn mouse_wheel(&self) -> f32
Get summarized mouse wheel movement (the sum of all movements since last frame).
sourcepub fn mouse_movements(&self) -> &[Vector2<f32>]
pub fn mouse_movements(&self) -> &[Vector2<f32>]
Get list of all mouse movements since last frame in pixels.
sourcepub fn mouse_movements_ndc(&self) -> &[Vector2<f32>]
pub fn mouse_movements_ndc(&self) -> &[Vector2<f32>]
Get list of all mouse movements since last frame in NDC.
sourcepub fn axes_movements(&self) -> &[(u8, f32)]
pub fn axes_movements(&self) -> &[(u8, f32)]
Get list of all raw inputs since last frame.
sourcepub fn mouse_delta(&self) -> Vector2<f32>
pub fn mouse_delta(&self) -> Vector2<f32>
Get summarized mouse movements (the sum of all movements since last frame) in pixels.
sourcepub fn mouse_delta_ndc(&self) -> Vector2<f32>
pub fn mouse_delta_ndc(&self) -> Vector2<f32>
Get summarized mouse movements (the sum of all movements since last frame) in NDC.
sourcepub fn mouse_delta_raw(&self) -> Vector2<f32>
pub fn mouse_delta_raw(&self) -> Vector2<f32>
Get summarized raw input along 0
and 1
axes since last frame.
It usually corresponds to mouse movements.
sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Return whether Window
is in focus or not.
sourcepub fn delta<D: Delta>(&self, delta: D) -> <D as Delta>::Output
pub fn delta<D: Delta>(&self, delta: D) -> <D as Delta>::Output
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.
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.
None
when no updates to the axis are received andSome(x)
wherex
is the sum of positive and negative inputs otherwise.
Auto Trait Implementations
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
value
as a parameter of self
.