pub struct InputState { /* private fields */ }Expand description
Real-time polled keyboard, pointer, and scroll input state for games and interactive viewports.
Implementations§
Source§impl InputState
Per-frame input ingestion and real-time polling helpers for InputState.
impl InputState
Per-frame input ingestion and real-time polling helpers for InputState.
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Clears transient per-frame edge states (just_pressed, just_released, deltas) after a frame step.
§Arguments
&Self- Mutable input state.
Sourcepub fn ingest(&mut self, event: &WindowEvent)
pub fn ingest(&mut self, event: &WindowEvent)
Updates continuous and edge-triggered states from a platform WindowEvent.
§Arguments
&Self- Mutable input state.&WindowEvent- Incoming OS or test event.
Sourcepub fn is_key_down(&self, key: KeyCode) -> bool
pub fn is_key_down(&self, key: KeyCode) -> bool
Sourcepub fn is_key_just_pressed(&self, key: KeyCode) -> bool
pub fn is_key_just_pressed(&self, key: KeyCode) -> bool
Sourcepub fn set_virtual_stick(&mut self, dx: f32, dy: f32)
pub fn set_virtual_stick(&mut self, dx: f32, dy: f32)
Sets the normalized analog virtual stick vector (dx, dy) for mobile touch joysticks or gamepads.
§Arguments
&Self- Mutable input state.f32- Horizontal axis in[-1.0, 1.0].f32- Vertical axis in[-1.0, 1.0].
Sourcepub fn clear_virtual_stick(&mut self)
pub fn clear_virtual_stick(&mut self)
Source§impl InputState
impl InputState
pub fn get_keys_down(&self) -> &HashSet<KeyCode>
pub fn get_mut_keys_down(&mut self) -> &mut HashSet<KeyCode>
pub fn set_keys_down(&mut self, val: HashSet<KeyCode>) -> &mut Self
pub fn get_keys_just_pressed(&self) -> &HashSet<KeyCode>
pub fn get_mut_keys_just_pressed(&mut self) -> &mut HashSet<KeyCode>
pub fn set_keys_just_pressed(&mut self, val: HashSet<KeyCode>) -> &mut Self
pub fn get_keys_just_released(&self) -> &HashSet<KeyCode>
pub fn get_mut_keys_just_released(&mut self) -> &mut HashSet<KeyCode>
pub fn set_keys_just_released(&mut self, val: HashSet<KeyCode>) -> &mut Self
pub fn get_pointer_position(&self) -> Point
pub fn get_mut_pointer_position(&mut self) -> &mut Point
pub fn set_pointer_position(&mut self, val: Point) -> &mut Self
pub fn get_pointer_delta(&self) -> Point
pub fn get_mut_pointer_delta(&mut self) -> &mut Point
pub fn set_pointer_delta(&mut self, val: Point) -> &mut Self
pub fn get_scroll_delta(&self) -> Point
pub fn get_mut_scroll_delta(&mut self) -> &mut Point
pub fn set_scroll_delta(&mut self, val: Point) -> &mut Self
pub fn get_virtual_axis(&self) -> Point
pub fn get_mut_virtual_axis(&mut self) -> &mut Point
pub fn set_virtual_axis(&mut self, val: Point) -> &mut Self
pub fn get_virtual_fire(&self) -> bool
pub fn get_mut_virtual_fire(&mut self) -> &mut bool
pub fn set_virtual_fire(&mut self, val: bool) -> &mut Self
pub fn get_virtual_dash(&self) -> bool
pub fn get_mut_virtual_dash(&mut self) -> &mut bool
pub fn set_virtual_dash(&mut self, val: bool) -> &mut Self
Source§impl InputState
impl InputState
Trait Implementations§
Source§impl Clone for InputState
impl Clone for InputState
Source§impl Debug for InputState
impl Debug for InputState
Auto Trait Implementations§
impl Forget for InputState
impl Freeze for InputState
impl Move for InputState
impl RefUnwindSafe for InputState
impl Send for InputState
impl Sync for InputState
impl Unpin for InputState
impl UnsafeUnpin for InputState
impl UnwindSafe for InputState
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