InputMapper Module
Subscription-based input mapping.
This is intentionally "push" driven: it listens to raw IInput deltas and dispatches a user message that contains the mapped ActionState.
Why this exists:
- keeps the user's update signature unchanged (no context parameter)
- user can opt into any model strategy by handling a single message
- supports dynamic remapping via a
getMap callback (e.g., backed by a ref/agent)
Functions and values
| Function or value |
Description
|
|
Gets the IInputMapper service from the game context. Throws if the service is not registered. Use Program.withInputMapper to ensure registration.
|
Full Usage:
subscribe getMap toMsg ctx
Parameters:
unit -> InputMap<'Action>
toMsg : ActionState<'Action> -> 'Msg
ctx : GameContext
Returns: Sub<'Msg>
|
Subscribe to mapped action state changes.
ActionState/ActionState are one-shot sets relative to the most recent hardware delta batch. If you store the state in your model, you typically want to clear one-shots each frame (or just treat them as event-like).
|
Full Usage:
subscribeStatic map toMsg ctx
Parameters:
InputMap<'Action>
toMsg : ActionState<'Action> -> 'Msg
ctx : GameContext
Returns: Sub<'Msg>
|
Convenience overload for static mappings.
|
|
Attempts to get the IInputMapper service from the game context. Returns ValueNone if the service is not registered (i.e., Program.withInputMapper wasn't used).
|
Mibo