Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Input

cinnabar:extension/input@0.1.0

Local control edges, available only with explicit controls authority.

Grants: controls, except demo-pressed, which needs no grant.

Imported type event: event.

Types

text-event

A committed native field value addressed by its declared control ID.

record text-event {
    id: string,
    value: string,
}
MemberTypeDescription
idstring
valuestring

field-key

A field navigation key with modifiers sampled at the key edge.

record field-key {
    id: string,
    key: string,
    shift: bool,
    control: bool,
    alt: bool,
    super-key: bool,
}
MemberTypeDescription
idstring
keystring
shiftbool
controlbool
altbool
super-keybool

field-event

A native edit, submission or navigation edge; composition remains host-owned.

variant field-event {
    change(text-event),
    submit(text-event),
    key(field-key),
}
MemberTypeDescription
changetext-event
submittext-event
keyfield-key

Types: field-key, text-event.

controls

One focused input sample; keys and pointer use the host’s coordinate and naming contracts.

record controls {
    seconds: f32,
    focused: bool,
    gameplay: bool,
    panel-open: bool,
    keys-pressed: list<string>,
    keys-held: list<string>,
    events: list<event>,
    pointer: option<tuple<f32, f32>>,
    wheel: f32,
}
MemberTypeDescription
secondsf32
focusedbool
gameplaybool
panel-openbool
keys-pressedlist<string>Physical non-repeat edges; pointer buttons use MouseLeft/MouseRight/MouseMiddle.
keys-heldlist<string>Physical keys held this frame, including reserved ones.
eventslist<event>
pointeroption<tuple<f32, f32>>Pointer position in the gameplay HUD root’s GUI units from its top left, the space of
hud.read-viewport, while this mod’s open panel owns input; none otherwise. A panel’s
own fitting, such as a reference_size scaled to a small window, does not change it.
wheelf32Wheel notches this frame while this mod’s panel owns input; positive scrolls up.

Types: event.

selection

Selects which fields to copy without changing the underlying frame or its event ordering.

record selection {
    keys-pressed: option<list<string>>,
    keys-held: option<list<string>>,
    events: bool,
}
MemberTypeDescription
keys-pressedoption<list<string>>None selects all keys; some(empty) selects none; names select exact matches.
keys-heldoption<list<string>>
eventsbool

Functions

demo-pressed

demo-pressed: func() -> bool;

True only for the current frame’s host-assigned action edge.

read-controls

read-controls: func() -> result<controls, string>;

Reads this callback’s control sample with controls authority and the shared read allowance.

Types: controls.

read-selected-controls

read-selected-controls: func(selection: selection) -> result<controls, string>;

Reads selected fields from the same current frame, preserving native key order. Requires controls authority and shares the read-controls callback read budget.

Types: controls, selection.

read-text-events

read-text-events: func() -> result<list<text-event>, string>;

Committed single-line native text edits, separate from legacy numeric control events. Requires controls authority; repeated reads see the same bounded batch in a frame callback.

Types: text-event.

read-field-events

read-field-events: func() -> result<list<field-event>, string>;

Live values coalesce per field between frame callbacks. Submit and navigation retain order. Navigation includes the modifiers sampled at that key edge; preedit stays host-local.

Types: field-event.

reserve-keys

reserve-keys: func(keys: list<string>) -> result<_, string>;

Physical key names reserved before the ordinary gameplay router samples them.