Skip to main content

Module input

Module input 

Source
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:

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 navigation::Navigation;
pub use navigation::NavigationConfig;
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 → InputEvent translation.
types
Platform-neutral input vocabulary.

Structs§

InputSystem
Named key-action registry with context dispatch.
KeyAction
One named action: trigger, focus context, repeat policy, and callback.
KeyBinding
One key-plus-modifiers trigger.
KeyboardState
Per-frame keyboard held-state snapshot, indexed by SDL scancode.
MouseState
Per-frame pointer-state snapshot.

Enums§

Button
Stable input-button identity for held/rising/falling queries.
InputContext
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 button is 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 button went down since the last update.
process_event
Feed one raw platform event into the per-frame snapshot.
release
Return whether button went up since the last update.
shutdown
Reset all input snapshots.
update
Fold queued events into held/rising/falling edges.