Skip to content

Runtime.Input (Visera.Runtime.Input)

Runtime.Input provides input subsystem: maps raw device input (keyboard, mouse) to logical actions and axes for game and UI. Supports multiple devices, action press/release/hold state, and mapping config to bind keys/buttons to named actions for cross-platform, configurable input.

Responsibilities

  • Action: Define logical actions (e.g. Jump, MoveX); boolean (press/release) and scalar (axis); game code depends on action name, not physical key.
  • Device: Abstract input device; keyboard and mouse key/button and motion state.
  • Mapping: Map physical input (key code, button, axis) to actions; multiple mapping sets or runtime switch.

  • PollAndSync: Call each frame on the main thread. Polls platform events and sets the current focused window from FPlatform::GetFocusedWindow(). If the platform reports no focus yet (e.g. window just opened), a fallback uses the single registered window when exactly one non-dummy window exists, so keyboard and mouse state are available immediately after opening the window.

Relation to Platform.GLFW: GLFW provides low-level window and input events; Runtime.Input consumes them and turns them into actions and device state for upper layers. Cursor positions delivered to Input are already in framebuffer (pixel) space on high-DPI platforms (e.g. macOS Retina), where the platform layer multiplies by window content scale.

Submodules

Module Description
Action Input action type and state.
Device Keyboard, Mouse.
Mapping Input mapping config and parsing.

See also