pub struct InputFrame {
pub actions: Vec<InputAction>,
pub movement: [f32; 2],
pub look_delta: [f32; 2],
pub scroll_delta: f32,
pub cursor_position: [f32; 2],
pub cursor_delta: [f32; 2],
pub timestamp: f32,
}Expand description
Per-frame input snapshot. Immutable once built. Consumed by game systems.
Separates input collection (platform-specific) from input consumption (game logic). Adapters write to InputFrameBuilder, then finalize to InputFrame.
Fields§
§actions: Vec<InputAction>Actions active this frame (just pressed or held).
movement: [f32; 2]Movement vector: [x, y] in [-1, 1]. Composite of WASD/stick/dpad. x: negative=left, positive=right. y: negative=backward, positive=forward.
look_delta: [f32; 2]Camera look delta: [dx, dy] in pixels or normalized units. dx: negative=look left, positive=look right. dy: negative=look up, positive=look down.
scroll_delta: f32Scroll wheel delta (positive=zoom in / scroll up).
cursor_position: [f32; 2]Cursor position in window coordinates [x, y].
cursor_delta: [f32; 2]Cursor delta since last frame [dx, dy].
timestamp: f32Frame timestamp (monotonic, seconds since start).
Implementations§
Source§impl InputFrame
impl InputFrame
Sourcepub fn has_action(&self, action: InputAction) -> bool
pub fn has_action(&self, action: InputAction) -> bool
Whether a specific action is active this frame.
Sourcepub fn has_movement(&self) -> bool
pub fn has_movement(&self) -> bool
Whether any movement input is present.
Sourcepub fn has_scroll(&self) -> bool
pub fn has_scroll(&self) -> bool
Whether any scroll input is present.
Trait Implementations§
Source§impl Clone for InputFrame
impl Clone for InputFrame
Source§fn clone(&self) -> InputFrame
fn clone(&self) -> InputFrame
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more