Expand description
oa::input — platform-neutral input layer.
Donor: oa/ui/platformInput.h and oa/ui/platformInput.cpp (SDL3 backend),
oa/ui/input.h and oa/ui/input.cpp (action registry).
The module owns everything between the platform and consumers:
sdl_events: SDL3 event translation (pixel scale, wheel-direction normalization, pinch-gesture bridging) intoInputEvent.- Per-frame snapshots:
process_event,update,down,press,release,keyboard,mouse,pointer_position. InputSystem: named key-action registry with context dispatch.
Per-frame usage:
ⓘ
oa::input::initialize();
// each frame, before clearing deltas:
for event in sdl_events { oa::input::process_event(&event); }
oa::input::update();
let mouse = oa::input::mouse();
oa::input::clear_for_next_frame();State is thread-local, matching the donor’s effectively main-thread SDL event pump: each thread that pumps events owns its own snapshot.
Re-exports§
pub use types::GAMEPAD_AXIS_LEFT_TRIGGER;pub use types::GAMEPAD_AXIS_LEFT_X;pub use types::GAMEPAD_AXIS_LEFT_Y;pub use types::GAMEPAD_AXIS_RIGHT_TRIGGER;pub use types::GAMEPAD_AXIS_RIGHT_X;pub use types::GAMEPAD_AXIS_RIGHT_Y;pub use types::GAMEPAD_BUTTON_BACK;pub use types::GAMEPAD_BUTTON_DPAD_DOWN;pub use types::GAMEPAD_BUTTON_DPAD_LEFT;pub use types::GAMEPAD_BUTTON_DPAD_RIGHT;pub use types::GAMEPAD_BUTTON_DPAD_UP;pub use types::GAMEPAD_BUTTON_EAST;pub use types::GAMEPAD_BUTTON_GUIDE;pub use types::GAMEPAD_BUTTON_LEFT_SHOULDER;pub use types::GAMEPAD_BUTTON_LEFT_STICK;pub use types::GAMEPAD_BUTTON_NORTH;pub use types::GAMEPAD_BUTTON_RIGHT_SHOULDER;pub use types::GAMEPAD_BUTTON_RIGHT_STICK;pub use types::GAMEPAD_BUTTON_SOUTH;pub use types::GAMEPAD_BUTTON_START;pub use types::GAMEPAD_BUTTON_WEST;pub use types::INPUT_MOD_ALT;pub use types::INPUT_MOD_CTRL;pub use types::INPUT_MOD_NONE;pub use types::INPUT_MOD_SHIFT;pub use types::INPUT_MOD_SUPER;pub use types::InputEvent;pub use types::InputEventKind;pub use types::InputModifiers;pub use types::InputState;pub use types::Key;pub use types::MotionSpeed;pub use types::PinchPhase;pub use types::ScrollGesture;
Modules§
- navigation
- 2-D viewer navigation (pan / zoom) state machine.
- sdl_
events - SDL3 →
InputEventtranslation. - types
- Platform-neutral input vocabulary.
Structs§
- Input
System - Named key-action registry with context dispatch.
- KeyAction
- One named action: trigger, focus context, repeat policy, and callback.
- KeyBinding
- One key-plus-modifiers trigger.
- Keyboard
State - Per-frame keyboard held-state snapshot, indexed by SDL scancode.
- Mouse
State - Per-frame pointer-state snapshot.
Enums§
- Button
- Stable input-button identity for held/rising/falling queries.
- Input
Context - Focus domain gating which actions a key event may reach.
Functions§
- clear_
for_ next_ frame - Clear per-frame deltas (scroll, motion delta, press/release edges).
- down
- Return whether
buttonis currently held. - initialize
- Initialize the input backend. Idempotent.
- keyboard
- Access the current keyboard held-state snapshot.
- mouse
- Access the current pointer-state snapshot.
- pointer_
position - Last known pointer position, updated on motion, buttons, and wheel.
- press
- Return whether
buttonwent down since the lastupdate. - process_
event - Feed one raw platform event into the per-frame snapshot.
- release
- Return whether
buttonwent up since the lastupdate. - shutdown
- Reset all input snapshots.
- update
- Fold queued events into held/rising/falling edges.