pub struct InputState { /* private fields */ }Expand description
Zero-allocation Copy 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 without_edges(&self) -> Self
pub fn without_edges(&self) -> Self
Returns a zero-allocation Copy snapshot containing held keys/buttons and axes with all transient edge events cleared.
Used when executing subsequent fixed-timestep substeps so press/release edges are consumed exactly once.
§Arguments
&Self- Input state reference.
§Returns
Self- Edge-cleared input snapshot preserving held state.
Sourcepub fn has_pending_edges(&self) -> bool
pub fn has_pending_edges(&self) -> bool
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 is_key_just_released(&self, key: KeyCode) -> bool
pub fn is_key_just_released(&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) -> KeyBitset
pub fn get_mut_keys_down(&mut self) -> &mut KeyBitset
pub fn set_keys_down(&mut self, val: KeyBitset) -> &mut Self
pub fn get_keys_just_pressed(&self) -> KeyBitset
pub fn get_mut_keys_just_pressed(&mut self) -> &mut KeyBitset
pub fn set_keys_just_pressed(&mut self, val: KeyBitset) -> &mut Self
pub fn get_keys_just_released(&self) -> KeyBitset
pub fn get_mut_keys_just_released(&mut self) -> &mut KeyBitset
pub fn set_keys_just_released(&mut self, val: KeyBitset) -> &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
pub fn get_modifiers(&self) -> Modifiers
pub fn get_mut_modifiers(&mut self) -> &mut Modifiers
pub fn set_modifiers(&mut self, val: Modifiers) -> &mut Self
Source§impl InputState
impl InputState
Trait Implementations§
Source§impl Clone for InputState
impl Clone for InputState
impl Copy for InputState
Source§impl Debug for InputState
impl Debug for InputState
Source§impl Default for InputState
impl Default for InputState
Source§impl PartialEq for InputState
impl PartialEq for InputState
impl StructuralPartialEq 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