Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

manifold:input 0.2.0

Contract reference · Payloads · contract.json (crates/manifold-wasm-abi/wit/contract.json)

Contract 0.2.0, track 0.2: open, unreleased. Nothing on track 0.2 is released yet, so any item may still change in place (spec §7.2).

InterfaceKindConsentSidesOwner
inputimportlistedclientinput

Interface input

import · consent listed · sides client · owner input · since 0.2.0

Requests a mod’s client half makes of the input system (input spec §15.4): its contexts, cursor requests through them, commands, haptics and events. Client side; consent class listed (input spec §15.6). Action states and device facts are bridged views (manifold:action_states_view, manifold:input_device_view, input spec §15.2), not functions here.

Calls work inside the mod’s own client systems, where the host lends the world; outside one they fail with outside-system (or return false).

Functions

context-active

context-active: func(id: string) -> bool

Whether the context is on the stack and not suspended.

cursor-grabbed

cursor-grabbed: func() -> bool

play-haptic

play-haptic: func(effect: haptic-effect) -> bool

False where the device or host cannot play it.

pop-context

pop-context: func(id: string)

push-context

push-context: func(id: string) -> result<_, context-error>

Push one of this mod’s layer contexts onto the stack.

set-base-context

set-base-context: func(id: string) -> result<_, context-error>

Replace the base context (game modules only).

set-context-cursor

set-context-cursor: func(id: string, mode: cursor-mode) -> result<_, context-error>

The cursor this mod’s context asks for while it is effective; the stack and the camera together decide (input spec §10.5).

submit-command

submit-command: func(action: string, payload: list<u8>) -> result<u8, command-error>

A postcard CommandPayload for a command action; it attaches to the next closing tick (input spec §13.6). The command’s sequence number.

take-events

take-events: func() -> list<input-event>

Events since the last call, in order.

Types

command-error (variant)

IndexCasePayloadAbout
0unknown-actionnone
1no-commandsnone
2no-edgenone
3queue-fullnone
4wrong-payloadnone
5wrong-sidenone
6outside-systemnone

context-error (variant)

IndexCasePayloadAbout
0unknown-contextnone
1not-ownernoneThe context is not in this mod’s namespace.
2wrong-bandnone
3not-game-modulenoneset-base-context from a mod that is not a game module.
4wrong-sidenone
5outside-systemnone

cursor-mode (enum)

IndexCaseAbout
0grabbed
1free
2inherit

device-class (enum)

IndexCaseAbout
0keyboard-mouse
1gamepad
2touch

haptic-effect (variant)

IndexCasePayloadAbout
0rumblerumble
1trigger-rumblerumble

input-event (variant)

IndexCasePayloadAbout
0context-suspendedstring
1context-resumedstring
2device-changeddevice-class
3bindings-changednone

rumble (record)

FieldTypeAbout
lowf32
highf32
duration-msu16