InputSnapshot Class
Immutable snapshot capturing input state at a specific point in time. More...
Declaration
Public Constructors Index
| InputSnapshot (const helios::input::gamepad::GamepadState &gamepadState) noexcept | |
|
Constructs an InputSnapshot capturing the current gamepad state. More... | |
Public Member Functions Index
| const helios::input::gamepad::GamepadState & | gamepadState () const noexcept |
|
Returns the captured gamepad state. More... | |
Private Member Attributes Index
| const helios::input::gamepad::GamepadState | gamepadState_ |
|
Captured gamepad state. More... | |
Description
Immutable snapshot capturing input state at a specific point in time.
InputSnapshot decouples input polling from input processing by capturing the complete input state at a single moment. This immutable design enables deterministic replay where snapshots can be recorded and replayed exactly, network synchronization by transmitting snapshots to remote clients, frame-consistent processing where all systems see identical input state, and multi-threaded safety as snapshots can be shared across threads without locking.
The current implementation captures only gamepad input. Future versions may extend this to include keyboard, mouse, and other input devices.
Typical usage: ```cpp // Capture input at start of frame auto snapshot = helios::input::InputSnapshot( inputManager.gamepadState(helios::input::types::Gamepad::ONE) );
// Process input (potentially in parallel or deferred) inputHandler.handleInput(snapshot, player, commandBuffer, deltaTime); ```
The snapshot is immutable after construction and reflects input state at construction time. Currently only supports a single gamepad; multi-input support is planned.
- Todo
-
Extend to support multiple gamepads, keyboard, and mouse input.
Add timestamp to enable precise replay and network synchronization.
Definition at line 45 of file InputSnapshot.ixx.
Public Constructors
InputSnapshot()
| inline explicit noexcept |
Constructs an InputSnapshot capturing the current gamepad state.
- Parameters
-
gamepadState The gamepad state to capture. Copied into the snapshot.
This operation is noexcept and cheap as GamepadState is a small struct. The snapshot remains valid even if the source state is modified or destroyed.
Definition at line 64 of file InputSnapshot.ixx.
Reference gamepadState.
Public Member Functions
gamepadState()
| inline nodiscard noexcept |
Returns the captured gamepad state.
- Returns
Const reference to the captured GamepadState, valid for the lifetime of this InputSnapshot. The state is immutable and reflects input at the time of snapshot creation.
Definition at line 75 of file InputSnapshot.ixx.
Referenced by InputSnapshot.
Private Member Attributes
gamepadState_
|
Captured gamepad state.
Stored as a const member to enforce immutability of the snapshot.
Definition at line 52 of file InputSnapshot.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.