pub struct InputManager { /* private fields */ }Expand description
Manages the state of all input devices (keyboard, mouse, touch, sensors).
InputManager tracks which keys and buttons are currently held down, which ones
were just pressed or released in the current frame, and aggregates touch/sensor data.
Implementations§
Source§impl InputManager
impl InputManager
Sourcepub fn text_input_enabled(&self) -> bool
pub fn text_input_enabled(&self) -> bool
Returns true if text input (IME) is currently enabled.
Sourcepub fn set_text_input_enabled(&mut self, enabled: bool)
pub fn set_text_input_enabled(&mut self, enabled: bool)
Enables or disables text input (IME). When disabled, text events are ignored.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Returns true if the window currently has input focus.
Sourcepub fn cursor_position(&self) -> Option<(Pt, Pt)>
pub fn cursor_position(&self) -> Option<(Pt, Pt)>
Returns the current hardware cursor position in logical coordinates.
Sourcepub fn scroll_delta(&self) -> (f32, f32)
pub fn scroll_delta(&self) -> (f32, f32)
Returns the scroll wheel delta since the last frame.
Sourcepub fn text_input(&self) -> &str
pub fn text_input(&self) -> &str
Returns the accumulated text input string for the current frame.
Sourcepub fn ime_preedit(&self) -> Option<&str>
pub fn ime_preedit(&self) -> Option<&str>
Returns the current IME pre-edit string (uncommitted text).
Sourcepub fn key_down(&self, key: Key) -> bool
pub fn key_down(&self, key: Key) -> bool
Returns true if the specified key is currently held down.
Sourcepub fn key_pressed(&self, key: Key) -> bool
pub fn key_pressed(&self, key: Key) -> bool
Returns true if the specified key was just pressed this frame.
Sourcepub fn key_released(&self, key: Key) -> bool
pub fn key_released(&self, key: Key) -> bool
Returns true if the specified key was just released this frame.
Sourcepub fn mouse_down(&self, button: SpotMouseButton) -> bool
pub fn mouse_down(&self, button: SpotMouseButton) -> bool
Returns true if the specified mouse button is currently held down.
Sourcepub fn mouse_pressed(&self, button: SpotMouseButton) -> bool
pub fn mouse_pressed(&self, button: SpotMouseButton) -> bool
Returns true if the specified mouse button was just pressed this frame.
Sourcepub fn mouse_released(&self, button: SpotMouseButton) -> bool
pub fn mouse_released(&self, button: SpotMouseButton) -> bool
Returns true if the specified mouse button was just released this frame.
pub fn end_frame(&mut self)
Trait Implementations§
Source§impl Clone for InputManager
impl Clone for InputManager
Source§fn clone(&self) -> InputManager
fn clone(&self) -> InputManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InputManager
impl Debug for InputManager
Auto Trait Implementations§
impl Freeze for InputManager
impl RefUnwindSafe for InputManager
impl Send for InputManager
impl Sync for InputManager
impl Unpin for InputManager
impl UnsafeUnpin for InputManager
impl UnwindSafe for InputManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.