[Old] The Þog of 2024-01-01 — WebAssembly Applet Spec
WIP
Exports
AppletStart
Called by the host to initialize the module.
AppletQuit
Called by the host to notify it's shutting down. (Currently not really that useful)
AppletRender
Called by the host to tell the module to refresh its framebuffer.
AppletEvent
Called by the host in response to mouse or key events.
- Kind 0x00: Key press (scancode, codepoint, modifiers)
- Kind 0x01: Key release (scancode, codepoint, modifiers)
- Kind 0x02: Mouse button press (x, y, button)
- Kind 0x03: Mouse button release (x, y, button)
- Kind 0x04: Absolute mouse position (x, y, buttons)
- Kind 0x05: Mouse movement delta (x, y, buttons)
Key scancodes and modifiers are TBD.
AppletDisplayWidth
Returns the module's display width. The host should only call this once at startup.
AppletDisplayHeight
Returns the module's display height. The host should only call this once at startup.
AppletDisplayPtr
Returns a pointer to an array of width*height RGBA bytes. The host should only call this once at startup.
Imports
Applet.Write
A debugging aid. Writes UTF-8 text to an optional text buffer, without a newline.
Applet.SetCursorLock
Requests the host to lock the cursor. Locked cursor movement gives mouse delta events instead of absolute position events.
Applets should account for the host not locking the cursor. Ideally, the host should try to lock the cursor when able.
Applet.Quit
Requests the host to quit. The host should call AppletQuit, like in any other quit condition.