InputMapping

Maps sequences input events to input actions.

Actions are bound to "strokes". A single stroke is a set of modifier events and a trigger event. A stroke without modifiers is one that directly binds a button or key to an action, for example mapping the backspace key to an "eraseCharacter" action. Modifiers can be added to require that multiple other buttons be held for the action to work — the "ctrl+C" stroke, often used to copy text, has one modifier key "ctrl" and a trigger key "c".

Mappings are grouped by modifiers into "layers". All mappings that share the same set of modifiers will be placed on the same layer. These layers are sorted by number of modifiers, and only one is looked up at once; this prevents firing an action with a less complex set of modifiers from accidentally firing when performing a more complex one. For example, an action bound to the key "C" will not fire when pressing "ctrl+C".

Mappings can combine multiple input events, so it is possible to use both keyboard keys and mouse buttons in a mapping. A mouse button could be used as a trigger, combined with a keyboard key as a modifier, such as "ctrl + left mouse button".

Members

Functions

bindNew
void bindNew(InputActionID action, InputEventCode[] codes)
void bindNew(InputEventCode[] codes)

Bind an input stroke to an input action.

Static functions

defaultMapping
InputMapping defaultMapping()

Create a default input map using commonly used input sequences for each of the default actions.

Structs

Layer
struct Layer

A layer groups all mappings that share the same set of input event codes.

Trigger
struct Trigger

Final element in a stroke, completing the circuit and creating the event.

Variables

layers
Layer[] layers;

All input layers that have been mapped.

Meta