pub struct Input;Expand description
Provides access to controller, keyboard, and touchscreen input.
Implementations§
Source§impl Input
impl Input
Returns true if button is currently held down.
Returns true if button was pressed this frame.
Returns true if button was released this frame.
Sourcepub fn get_stick_l() -> (f32, f32)
pub fn get_stick_l() -> (f32, f32)
Returns the left analog stick position as (x, y) in the range [-1.0, 1.0].
Sourcepub fn get_stick_r() -> (f32, f32)
pub fn get_stick_r() -> (f32, f32)
Returns the right analog stick position as (x, y) in the range [-1.0, 1.0].
Sourcepub fn is_connected() -> bool
pub fn is_connected() -> bool
Returns true if a controller is connected.
Sourcepub fn get_touch() -> Option<(f32, f32)>
pub fn get_touch() -> Option<(f32, f32)>
Returns the current touch position as Some((x, y)), or None if the screen is not touched.
Sourcepub fn is_key_down(key: Key) -> bool
pub fn is_key_down(key: Key) -> bool
Returns true if key is currently held down.
Sourcepub fn is_key_pressed(key: Key) -> bool
pub fn is_key_pressed(key: Key) -> bool
Returns true if key was pressed this frame.
Sourcepub fn is_key_released(key: Key) -> bool
pub fn is_key_released(key: Key) -> bool
Returns true if key was released this frame.
Sourcepub fn is_shift_down() -> bool
pub fn is_shift_down() -> bool
Returns true if either Shift key is held down.
Sourcepub fn is_ctrl_down() -> bool
pub fn is_ctrl_down() -> bool
Returns true if either Ctrl key is held down.
Sourcepub fn is_alt_down() -> bool
pub fn is_alt_down() -> bool
Returns true if either Alt key is held down.
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnsafeUnpin for Input
impl UnwindSafe for Input
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more