pub struct InputState {
pub fabric: FabricInput,
pub orbit_dx: f32,
pub orbit_dy: f32,
pub scroll_delta: f32,
/* private fields */
}Expand description
Runtime input state. Wraps FabricInput with winit-specific translation.
Fields§
§fabric: FabricInput§orbit_dx: f32Accumulated orbit yaw delta from right-click drag (consumed by chase camera).
orbit_dy: f32Accumulated orbit pitch delta from right-click drag (consumed by chase camera).
scroll_delta: f32Scroll zoom delta (consumed by chase camera distance).
Implementations§
Source§impl InputState
impl InputState
pub fn new() -> Self
Sourcepub fn handle_keyboard(&mut self, event: &KeyEvent)
pub fn handle_keyboard(&mut self, event: &KeyEvent)
Translate a winit KeyEvent into VirtualKey press/release.
Translate a winit mouse button event.
Sourcepub fn handle_cursor_move(&mut self, x: f32, y: f32)
pub fn handle_cursor_move(&mut self, x: f32, y: f32)
Feed cursor movement.
Sourcepub fn handle_scroll(&mut self, delta: &MouseScrollDelta)
pub fn handle_scroll(&mut self, delta: &MouseScrollDelta)
Feed scroll wheel.
Sourcepub fn apply_to_camera(&mut self, camera: &mut Camera, dt: f32)
pub fn apply_to_camera(&mut self, camera: &mut Camera, dt: f32)
Apply input state to camera. dt is frame delta time in seconds
for frame-rate independent movement.
Sourcepub fn apply_mouse_to_camera(&mut self, _camera: &mut Camera, _dt: f32)
pub fn apply_mouse_to_camera(&mut self, _camera: &mut Camera, _dt: f32)
Apply only mouse/scroll input for chase camera (no WASD pan). Used when simulation is active and WASD drives the player kernel. Accumulates orbit_dx, orbit_dy, and scroll_delta for the chase camera in app.rs.
Sourcepub fn handle_touch(&mut self, phase: TouchPhase, id: u64, x: f32, y: f32)
pub fn handle_touch(&mut self, phase: TouchPhase, id: u64, x: f32, y: f32)
Handle touch input (mobile/tablet). Single-finger drag: pan. Two-finger pinch: zoom. Two-finger rotate: orbit.
Trait Implementations§
Auto Trait Implementations§
impl Freeze 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
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more