pub struct MovementState {
pub keys: ClientKeyBindings,
/* private fields */
}Expand description
Keyboard movement state.
Cardinals: WASD / arrows. Hold two cardinals for diagonal (mouse pathing also works). Space hard-stops. Idle timeout is a fallback if the terminal omits releases.
Fields§
§keys: ClientKeyBindingsImplementations§
Source§impl MovementState
impl MovementState
pub fn with_keys(keys: ClientKeyBindings) -> Self
pub fn idle_timeout(&self) -> Duration
pub fn reset(&mut self)
pub fn sprint_mode(&self) -> bool
pub fn toggle_sprint_mode(&mut self)
pub fn vertical_axis(&self) -> f32
pub fn sprinting(&self) -> bool
pub fn last_move_axes(&self) -> (f32, f32)
pub fn current(&self) -> MovementInput
pub fn apply_ui_key( &mut self, key: UiKeyEvent, overlay: ActiveOverlay, map_target_active: bool, ) -> InputAction
Sourcepub fn expire_idle(&mut self, idle: Duration)
pub fn expire_idle(&mut self, idle: Duration)
Drop keys whose last press/repeat is older than idle.
Call once per movement tick. Never permanently latches chords.
Trait Implementations§
Source§impl Debug for MovementState
impl Debug for MovementState
Auto Trait Implementations§
impl Freeze for MovementState
impl RefUnwindSafe for MovementState
impl Send for MovementState
impl Sync for MovementState
impl Unpin for MovementState
impl UnsafeUnpin for MovementState
impl UnwindSafe for MovementState
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