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

Touch

cinnabar:extension/touch@0.1.0

Mod-owned on-screen buttons drawn in the built-in touch control style while touch controls are shown. Players move them in the touch layout editor. Requires controls authority.

Grants: controls.

Types

point

A GUI-pixel pair.

record point {
    x: f32,
    y: f32,
}
MemberTypeDescription
xf32
yf32

anchor

The screen edge or centre a placement measures from.

enum anchor {
    top-left,
    top-center,
    top-right,
    left,
    center,
    right,
    bottom-left,
    bottom-center,
    bottom-right,
}
MemberTypeDescription
top-left
top-center
top-right
left
center
right
bottom-left
bottom-center
bottom-right

button

A retained mod-owned touch control with player-adjustable default placement.

record button {
    id: string,
    label: string,
    anchor: anchor,
    offset: point,
    size: point,
}
MemberTypeDescription
idstring1–32 bytes of lowercase ASCII letters, digits, _ and -. A player’s saved
placement is keyed by it, so prefix it with the mod’s name; when two mods use one
id, only the earlier mod’s button is shown.
labelstringOne line of 1–24 bytes of plain text without § codes, drawn centred as written.
anchoranchorDefault placement, in GUI pixels inward from the anchored edges or right/down from
centred axes, each at most 1024.
offsetpoint
sizepointWidth and height in GUI pixels, each 18 through 96.

Types: anchor, point.

Functions

set-buttons

set-buttons: func(buttons: list<button>) -> result<_, string>;

Replaces this instance’s retained buttons, at most 4; an empty list removes them. Committed after a successful callback; quarantine, unload and revocation remove them.

Types: button.

read-presses

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

IDs of this instance’s buttons tapped since its previous frame callback, oldest first. A tap completes when the finger lifts inside the button. Empty outside frame; a deferred frame keeps the taps for the next one.