InputMapper Module
Functions and values
| Function or value |
Description
|
Full Usage:
subscribe getMap toMsg ctx
Parameters:
unit -> InputMap<'Action>
toMsg : ActionState<'Action> -> 'Msg
ctx : GameContext
Returns: Sub<'Msg>
Type parameters: 'Action, 'Msg (requires comparison) |
Elmish subscription that builds an ActionState from the registered IInput observables and the supplied map. Backend-neutral apart from the "is key down" poller, which reads MonoGame state.
|
Full Usage:
subscribeAdaptive getMap actions ctx
Parameters:
unit -> InputMap<'Action>
actions : cval<ActionState<'Action>>
ctx : GameContext
Returns: AdaptiveSub
Type parameters: 'Action (requires comparison) |
Adaptive subscription that builds an ActionState from
the registered IInput observables and the supplied map,
and writes it into the actions root. This is the
adaptive counterpart of InputMapper.subscribe with
the root as the sink (no
CONSUMING:
val s: obj
val a: obj
A manual actions.Set(ActionState.nextFrame s) write stays legal
but is redundant; the root's equality gate makes it free. The clear
runs before the frame force and before work posted from Update,
so a projection over Started forced in the frame builder and an
intent that reads Started both see the cleared state: read the
edges (or materialize the derived value) in Update instead. One
exception: a fixed-step frame with no sub-step runs no Update
and no drain, so the clear waits and the edges stay in the root for
the next sub-step's Update.
EDGES ACCUMULATE between consumptions: every delta (keyboard, mouse,
gamepad) builds a full state and the write MERGES its edges into the root's
unread edges (ActionState.mergeEdges) — a
mouse-move build between a key press and its release must not drop the key's
edges.
COST: the write is cheap (merging with empty edges reuses the existing sets;
the changeable's equality gate skips no-op writes), but the BUILD is real
per-event work — the same cost the Msg-dispatching
FRAME ONE: subscriptions attach at the first
|
Full Usage:
subscribeStatic map toMsg ctx
Parameters:
InputMap<'Action>
toMsg : ActionState<'Action> -> 'Msg
ctx : GameContext
Returns: Sub<'Msg>
Type parameters: 'Action, 'Msg (requires comparison) |
Elmish subscription variant for a fixed (non-changing) InputMap.
|
Full Usage:
subscribeStaticAdaptive map actions ctx
Parameters:
InputMap<'Action>
actions : cval<ActionState<'Action>>
ctx : GameContext
Returns: AdaptiveSub
Type parameters: 'Action (requires comparison) |
Adaptive subscription variant for a fixed (non-changing) InputMap.
|
Mibo