Header menu logo Mibo

InputMap<'Action> Type

Configuration mapping game actions to their trigger inputs.

InputMap is immutable and can be stored in your model. Use the InputMap module functions to build mappings.

Example

 type Action = MoveLeft | MoveRight | Jump | Fire

 let inputMap =
     InputMap.empty
     |> InputMap.key MoveLeft Keys.A
     |> InputMap.key MoveLeft Keys.Left
     |> InputMap.key MoveRight Keys.D
     |> InputMap.key MoveRight Keys.Right
     |> InputMap.key Jump Keys.Space
     |> InputMap.mouse Fire 0  // Left click
     |> InputMap.gamepadButton Jump PlayerIndex.One Buttons.A
type Action = | MoveLeft | MoveRight | Jump | Fire
val inputMap: obj
union case Action.MoveLeft: Action
union case Action.MoveRight: Action
union case Action.Jump: Action
union case Action.Fire: Action

Record fields

Record Field Description

ActionToTriggers

Full Usage: ActionToTriggers

Field type: Map<'Action, Trigger list>

Map from action to all triggers that can activate it.

Field type: Map<'Action, Trigger list>

TriggerToActions

Full Usage: TriggerToActions

Field type: Map<Trigger, 'Action list>

Reverse lookup: map from trigger to all actions it activates.

Field type: Map<Trigger, 'Action list>

Type something to start searching.