💾 Archived View for thingvellir.net › log › 2024-01-01.gmi captured on 2024-12-17 at 10:17:53. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-12)

🚧 View Differences

-=-=-=-=-=-=-

[Old] The Þog of 2024-01-01 — WebAssembly Applet Spec

WIP

Exports

AppletStart

export fn AppletStart() -> void

Called by the host to initialize the module.

AppletQuit

export fn AppletQuit() -> void

Called by the host to notify it's shutting down. (Currently not really that useful)

AppletRender

export fn AppletRender() -> void

Called by the host to tell the module to refresh its framebuffer.

AppletEvent

export fn AppletEvent(
    kind: i32,
    arg_1: i32,
    arg_2: i32,
    arg_3: i32
) -> i32

Called by the host in response to mouse or key events.

Key scancodes and modifiers are TBD.

AppletDisplayWidth

export fn AppletDisplayWidth() -> i32

Returns the module's display width. The host should only call this once at startup.

AppletDisplayHeight

export fn AppletDisplayHeight() -> i32

Returns the module's display height. The host should only call this once at startup.

AppletDisplayPtr

export fn AppletDisplayPtr -> *u32

Returns a pointer to an array of width*height RGBA bytes. The host should only call this once at startup.

Imports

Applet.Write

import fn Applet.Write(ptr: *u8, len: u32) -> void

A debugging aid. Writes UTF-8 text to an optional text buffer, without a newline.

Applet.SetCursorLock

import fn Applet.SetCursorLock(enable: i32) -> void

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

import fn Applet.Quit(code: i32) -> noreturn

Requests the host to quit. The host should call AppletQuit, like in any other quit condition.