Skip to content

InputContext Class

SDL3 implementation of the input context. Subscribes to internal SDL events and maintains per-frame input state. Publishes high-level, framework-agnostic events for user code.

internal sealed class InputContext : Brine2D.Input.IInputContext, System.IDisposable

Inheritance System.Object → InputContext

Implements IInputContext, System.IDisposable

Remarks

Thread-safe: all mutable state is guarded by Brine2D.Input.InputContext._stateLock. The lock is never held while publishing events to avoid deadlocks when user handlers query input state re-entrantly.

Methods
ClearFrameState() Clears all per-frame input state. Called directly by unit tests to simulate a new frame boundary.
SnapshotAxisState() Promotes the previous frame's current axis state to the previous buffer, then captures a fresh snapshot of live axis values into the current buffer. Called at frame start so that Brine2D.Input.InputContext.IsGamepadAxisPressed(Brine2D.Input.GamepadAxis,System.Int32) and Brine2D.Input.InputContext.IsGamepadAxisReleased(Brine2D.Input.GamepadAxis,System.Int32) can compare last frame's state against this frame's live values.