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).
| Interface | Kind | Consent | Sides | Owner |
|---|---|---|---|---|
input | import | listed | client | input |
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.
payload: schema payloadcommand-payload.
take-events
take-events: func() -> list<input-event>
Events since the last call, in order.
Types
command-error (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | unknown-action | none | |
| 1 | no-commands | none | |
| 2 | no-edge | none | |
| 3 | queue-full | none | |
| 4 | wrong-payload | none | |
| 5 | wrong-side | none | |
| 6 | outside-system | none |
context-error (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | unknown-context | none | |
| 1 | not-owner | none | The context is not in this mod’s namespace. |
| 2 | wrong-band | none | |
| 3 | not-game-module | none | set-base-context from a mod that is not a game module. |
| 4 | wrong-side | none | |
| 5 | outside-system | none |
cursor-mode (enum)
| Index | Case | About |
|---|---|---|
| 0 | grabbed | |
| 1 | free | |
| 2 | inherit |
device-class (enum)
| Index | Case | About |
|---|---|---|
| 0 | keyboard-mouse | |
| 1 | gamepad | |
| 2 | touch |
haptic-effect (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | rumble | rumble | |
| 1 | trigger-rumble | rumble |
input-event (variant)
| Index | Case | Payload | About |
|---|---|---|---|
| 0 | context-suspended | string | |
| 1 | context-resumed | string | |
| 2 | device-changed | device-class | |
| 3 | bindings-changed | none |
rumble (record)
| Field | Type | About |
|---|---|---|
low | f32 | |
high | f32 | |
duration-ms | u16 |