API Reference #
This page is a compact map of the public developer surface. The generated budo-llm.md file in the repository is the exhaustive source for signatures, edge cases, and WebAssembly import lists. Use this page when you want to remember where something lives.
CLI #
Budo Pro:
android-apkandandroid-aabare paid Android packaging commands. Public builds report that the feature is unavailable until the private Android feature pack is installed underprivate/android.
budo run <DIRECTORY|FILE> [--width N] [--height N] [--title STR] [--fullscreen] [--no-vsync] [--file-root PATH]
budo run --from-input js|ts|lua|wat|wasm [--width N] [--height N] [--title STR] [--fullscreen] [--no-vsync] [--file-root PATH]
budo <DIRECTORY>
budo init <DIRECTORY>
budo web-serve <DIRECTORY>
budo web-export <DIRECTORY> [-o DIR]
budo android-apk <DIRECTORY> [--release|--debug] [--install] [--no-build] [--clean] [-o DIR]
budo android-aab <DIRECTORY> [--release|--debug] [--no-build] [--clean] [-o DIR]
budo budo.d.ts
budo budo-llm.md
budo version # also --version, -v
budo helpJavaScript globals #
JavaScript and TypeScript apps run in QuickJS. Budo injects sys, console, fetch, and subsystem aliases where documented.
The sys tree contains canvas, transform, path, svg, font, graphics, gl, math, input, window, animation, timer, audio, midi, db, file, network, udp, magneto, device, neural, and capabilities.
sys.animation #
sys.animation.requestFrame(callback)
sys.animation.cancelFrame(handle)Register one frame callback. The callback receives a timestamp in milliseconds.
sys.timer #
sys.timer.once(delay, callback)
sys.timer.every(interval, callback)
sys.timer.clear(id)JavaScript-only frame-resolution timers.
sys.window #
sys.window.getWidth()
sys.window.getHeight()
sys.window.getDisplayDensity()Use display density for UI that should keep a stable physical size across devices.
sys.input #
sys.input.get()
sys.input.isKeyDown(scancode)
sys.input.isKeyPressed(scancode)
sys.input.startTextInput({text, selectionStart, selectionEnd, multiline?})
sys.input.updateTextInput({text, selectionStart, selectionEnd, caret:{x,y,width,height}})
sys.input.stopTextInput()get() returns pointer, pointer list, timing, modifier, focus, committed text, full textEdit replacements, persistent composition, and textInputActive. Apply textEdit before sending the current model back through updateTextInput. Text sessions provide IME composition, selection edits, candidate positioning, and soft-keyboard lifecycle on desktop, web, and Android. Android Back and single-line Done/Return finalize composition into textEdit. Text selections use UTF-16 code units. Scancode queries remain physical and layout-independent.
sys.capabilities #
Capability entries have an available boolean. The main entries are neural, midi, udp, http and sensors.
if (sys.capabilities.udp.available) {
console.log('UDP enabled');
}sys.canvas #
sys.canvas.clear(color)
sys.canvas.drawRect(x, y, width, height)
sys.canvas.drawRoundRect(x, y, width, height, rx, ry)
sys.canvas.drawCircle(cx, cy, radius)
sys.canvas.drawOval(x, y, width, height)
sys.canvas.drawLine(x1, y1, x2, y2)
sys.canvas.drawPoint(x, y)
sys.canvas.drawText(text, x, y, fontSize)
sys.canvas.measureText(text, fontSize)
sys.canvas.measureTextRect(text, fontSize)
sys.canvas.drawArc(x, y, width, height, startAngle, sweepAngle, useCenter)
sys.canvas.readPixels()
sys.canvas.save()
sys.canvas.restore()
sys.canvas.translate(dx, dy)
sys.canvas.rotate(degrees)
sys.canvas.rotate(degrees, px, py)
sys.canvas.scale(sx, sy)
sys.canvas.skew(sx, sy)
sys.canvas.reset()
sys.canvas.clipRect(x, y, width, height)The optional fontSize defaults to 32 for drawing and measurement.
Colors accept #RRGGBB, #RRGGBBAA, or numeric ARGB.
Canvas paint state #
sys.canvas.setFillColor(color)
sys.canvas.setStrokeColor(color)
sys.canvas.setStrokeWidth(width)
sys.canvas.setAntiAlias(enabled)
sys.canvas.setAlpha(alpha)
sys.canvas.setStrokeCap(cap)
sys.canvas.setStrokeJoin(join)
sys.canvas.setBlendMode(mode)
sys.canvas.setImageFilter(name, ...args)
sys.canvas.setColorFilter(name, ...args)
sys.canvas.getError()Blend modes, image filters, and color filters are advanced Skia APIs.
sys.path #
const path = sys.path.create()
sys.path.reset(path)
sys.path.moveTo(path, x, y)
sys.path.lineTo(path, x, y)
sys.path.quadTo(path, x1, y1, x2, y2)
sys.path.cubicTo(path, x1, y1, x2, y2, x3, y3)
sys.path.close(path)
sys.path.addRect(path, x, y, width, height)
sys.path.addCircle(path, cx, cy, radius)
sys.canvas.drawPath(path)sys.svg and sys.font #
const svg = sys.svg.load('icon.svg')
const svgFromBytes = sys.svg.loadFromBuffer(svgBytes)
sys.canvas.drawSvg(svg, x, y, width, height)
sys.svg.destroy(svg)
sys.svg.getWidth(svg)
sys.svg.getHeight(svg)
sys.font.load(path, name)
sys.font.loadFromBuffer(fontBytes, name)
sys.canvas.setFont(name)
sys.font.reset()sys.gl #
const program = sys.gl.createShaderProgram('shader.vert', 'shader.frag')
sys.gl.bindScreen()
program.uniform1f('u_strength', 0.5).drawFullscreen()
const handle = sys.gl.createProgram('shader.vert', 'shader.frag')
const handleFromBytes = sys.gl.createProgramFromBuffer(vertexBytes, fragmentBytes)
sys.gl.destroyProgram(program)
sys.gl.drawFullscreen(program)
sys.gl.drawFullscreenImmediate(program, sourceTexture)
sys.gl.drawRegion(program, x, y, width, height, targetId)
sys.gl.drawRegionImmediate(program, x, y, width, height, targetId)
sys.gl.drawMeshImmediate(program, layout, options)
sys.gl.getLastError()
sys.gl.getProjectDir()GL operations are immediate. Uniforms include scalar, vector, array, and matrix forms such as setUniform1f, setUniform3fv, and setUniformMatrix4.
createShaderProgram returns a chainable ShaderProgram wrapper around the same immediate GL state. It supports use, uniform1i, uniform1f, uniform2f, uniform3f, uniform4f, uniformMatrix4, texture, canvasTexture, renderTargetTexture, drawFullscreen, drawRegion, and drawMesh. The handle API and object API can be mixed when that keeps setup code readable.
Render targets, buffers, vertex layouts, textures, cubemaps, mesh draws, and instanced mesh draws are also available. Resource loaders that normally take project-relative paths also have FromBuffer variants for bytes from file.readBinary(), fetch().arrayBuffer(), or other sources. See Rendering and shaders for the model and budo-llm.md for the full signature list.
sys.graphics #
const surface = sys.graphics.createCanvasTexture(512, 256)
surface.canvas.drawText('HUD', 32, 96, 42)
program.canvasTexture('u_hud', surface, 1).drawFullscreen()
surface.destroy()Canvas textures are Skia surfaces backed by GL textures and framebuffers. They are useful for drawing text, UI, or vector content into a texture that a shader can sample.
sys.math #
Math helpers mutate caller-owned arrays. Matrix layout is column-major.
sys.math.mat4Identity(out)
sys.math.mat4Multiply(out, a, b)
sys.math.mat4Perspective(out, fovy, aspect, near, far)
sys.math.mat4Ortho(out, left, right, bottom, top, near, far)
sys.math.mat4LookAt(out, eye, target, up)
sys.math.mat4Translate(out, a, v)
sys.math.mat4RotateX(out, a, radians)
sys.math.mat4RotateY(out, a, radians)
sys.math.mat4RotateZ(out, a, radians)
sys.math.mat4Scale(out, a, v)
sys.math.mat4Invert(out, a)
sys.math.mat4Transpose(out, a)
sys.math.vec3Add(out, a, b)
sys.math.vec3Sub(out, a, b)
sys.math.vec3Scale(out, a, scale)
sys.math.vec3Normalize(out, a)
sys.math.vec3Cross(out, a, b)
sys.math.vec3Dot(a, b)
sys.math.vec3Length(a)
sys.math.vec3TransformMat4(out, a, matrix)
sys.math.quatFromAxisAngle(out, axis, radians)
sys.math.quatMultiply(out, a, b)
sys.math.quatSlerp(out, a, b, t)
sys.math.quatToMat4(out, q)sys.audio #
sys.audio.start()
sys.audio.stop()
sys.audio.isPlaying()
sys.audio.setMasterGain(gain)
sys.audio.getMasterGain()
sys.audio.createOscillator()
sys.audio.destroyOscillator(id)
sys.audio.setOscillatorType(id, type)
sys.audio.setOscillatorFrequency(id, frequency)
sys.audio.setOscillatorGain(id, gain)
sys.audio.setOscillatorDetune(id, cents)
sys.audio.setOscillatorEnvelope(id, attack, decay, sustain, release)
sys.audio.startOscillator(id)
sys.audio.stopOscillator(id)
sys.audio.noteOn(id)
sys.audio.noteOff(id)
sys.audio.createBuffer(sampleRate, channels, samples)
sys.audio.loadBuffer(path)
sys.audio.loadBufferFromBuffer(buffer)
sys.audio.setBufferData(buffer, samplesArray, offset)
sys.audio.destroyBuffer(buffer)
sys.audio.playBuffer(buffer, loop, gain)
sys.audio.stopBuffer(playback)
sys.audio.midiToFreq(note)
sys.audio.getError()createBuffer allocates an empty mono or stereo PCM buffer. loadBuffer decodes a project-relative WAV, MP3, Ogg Vorbis, or FLAC asset; loadBufferFromBuffer decodes the same formats from an ArrayBuffer. Both return a buffer ID, or -1 on failure. Play either kind of buffer with playBuffer; use getError() after a failed load to inspect the last audio error.
sys.midi #
sys.midi.getInputCount()
sys.midi.getOutputCount()
sys.midi.getInputDevices()
sys.midi.getOutputDevices()
sys.midi.refreshDevices()
sys.midi.onDevicesChanged(callbackOrNull)
sys.midi.openInput(deviceIndex, callback)
sys.midi.closeInput(handle)
sys.midi.openOutput(deviceIndex)
sys.midi.closeOutput(handle)
sys.midi.sendMessage(handle, status, data1, data2)
sys.midi.sendRaw(handle, bytes)
sys.midi.noteOn(handle, channel, note, velocity)
sys.midi.noteOff(handle, channel, note, velocity)
sys.midi.controlChange(handle, channel, control, value)
sys.midi.programChange(handle, channel, program)
sys.midi.pitchBend(handle, channel, value)
sys.midi.channelPressure(handle, channel, pressure)
sys.midi.polyPressure(handle, channel, note, pressure)
sys.midi.createSession(name, port)
sys.midi.connectSession(session, host, port)
sys.midi.destroySession(session)
sys.midi.onSessionMessage(session, callback)
sys.midi.sessionSend(session, status, data1, data2)
sys.midi.sessionSendRaw(session, bytes)
sys.midi.getSessions()Constants include MIDI message types and common control-change numbers. onDevicesChanged establishes a silent baseline when registered, replaces any previous listener, and accepts null to unsubscribe. On a later topology change the callback runs on the runtime frame thread with {inputs, outputs, generation}. The snapshots are already refreshed and detect device replacement or reordering even when counts remain unchanged.
sys.db, sys.files, sys.assets, fetch, and sys.net.udp #
const db = sys.db.open(name)
sys.db.close(db)
sys.db.execute(db, sql)
sys.db.run(db, sql, ...params)
sys.db.query(db, sql, ...params)
sys.db.lastInsertId(db)
sys.db.getError()
sys.files.list(path)
sys.files.readText(path)
sys.files.readBinary(path)
sys.files.writeText(path, text)
sys.files.writeBinary(path, bytes)
sys.files.exists(path)
sys.files.isDirectory(path)
sys.files.size(path)
sys.files.pickText(callback, extension?)
sys.files.saveText(suggestedName, text, callback)
sys.files.getError()
// Read-only convenience wrapper over sys.files paths under assets/.
sys.assets.list(path)
sys.assets.readText(path)
sys.assets.readBinary(path)
sys.assets.exists(path)
sys.assets.isDirectory(path)
sys.assets.size(path)
sys.assets.getError()
fetch(url, options)
sys.net.fetch(url, options)
const socket = sys.net.udp.bind(port)
sys.net.udp.getPort(socket)
sys.net.udp.send(socket, host, port, bytes)
sys.net.udp.onMessage(socket, callback)
sys.net.udp.close(socket)sys.files is the canonical virtual filesystem. Except for a root list(), its paths start with assets/ or files/. sys.assets accepts bundle-relative paths, prepends assets/, exposes no write methods, and shares getError() state with sys.files. Therefore sys.assets.readText('config.json') is equivalent to sys.files.readText('assets/config.json'), while sys.assets.list() is equivalent to sys.files.list('assets'). JS pickText(callback, extension?) opens the platform system picker and returns whether it launched; an extension such as .json filters the picker and is enforced on the selected display name. The callback receives ({name,text}, null) or (null, error), and reads at most 8 MiB. saveText(name, text, callback) opens the platform Save As flow and reports null on success or an error string. Both APIs access locations outside Budo's mounts only through explicit user consent.
Network access is disabled until app.json declares a network policy.
sys.sensors, sys.device, and sys.neural #
sys.sensors.isAvailable()
sys.sensors.hasAccelerometer()
sys.sensors.hasCompass()
sys.sensors.start()
sys.sensors.stop()
sys.sensors.isActive()
sys.sensors.getAccel()
sys.sensors.getCompass()
sys.device.keepScreenOn(enabled)
sys.neural.isAvailable()
sys.neural.getError()
sys.neural.loadModel(path)
sys.neural.loadModelFromBuffer(buffer)
sys.neural.unloadModel(model)
sys.neural.getModelInfo(model)
sys.neural.setInput(model, name, data, shape)
sys.neural.run(model, inputs)
sys.neural.getOutput(model, name)Neural inference requires ONNX Runtime support and "neural": true in app.json.
Lua reference #
Lua uses the same sys namespace names for canvas, paint, transform, path, SVG, font, GL, input, window, animation, audio, MIDI, SQLite, files/assets, network, UDP, sensors, device, neural, math, and capabilities.
Differences are language-shaped. Lists are 1-based. fetch is callback-based. readBinary returns a Lua string. Neural tensors are Lua tables. sys.timer is JavaScript-only.
local function frame(timestamp)
sys.canvas.clear('#101116')
sys.canvas.setFillColor('#ffffff')
sys.canvas.drawText('Lua', 32, 64, 24)
sys.animation.requestFrame(frame)
end
sys.animation.requestFrame(frame)WebAssembly reference #
WebAssembly imports host functions from env. Names use snake case: canvas_clear, canvas_set_fill_color, transform_translate, path_create, gl_create_program, audio_create_oscillator, db_open, files_read_text, udp_bind, midi_open_input, magneto_get_accel, device_keep_screen_on, neural_load_model, and so on. File import paths start with assets/ or files/. WebAssembly has no sys namespace, so sys.assets does not add a separate import family; use env.files_* with an assets/ path.
String-backed imports take pointer and length pairs. Tensor and pixel APIs copy through exported linear memory. Optional features should be guarded with capability imports or compiled into target-specific modules.
For the complete import list, generate or open budo-llm.md from the same Budo build you ship.
<!-- BEGIN GENERATED API AVAILABILITY -->
Runtime availability #
This section is generated from api/contracts/*.json. Each cell names the guest-visible export; - means that operation is not exposed to that runtime. Platform lists describe where each runtime adapter is registered.
audio #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
start | () -> void | sys.audio.start | sys.audio.start | env.audio_start | - |
stop | () -> void | sys.audio.stop | sys.audio.stop | env.audio_stop | - |
is_playing | () -> bool | sys.audio.isPlaying | sys.audio.isPlaying | - | - |
set_master_gain | (gain: f32) -> void | sys.audio.setMasterGain | sys.audio.setMasterGain | env.audio_set_master_gain | - |
get_master_gain | () -> f32 | sys.audio.getMasterGain | sys.audio.getMasterGain | - | - |
create_oscillator | () -> i32 oscillator_id; -1 on failure | sys.audio.createOscillator | sys.audio.createOscillator | env.audio_create_oscillator | - |
destroy_oscillator | (oscillator_id: i32) -> void | sys.audio.destroyOscillator | sys.audio.destroyOscillator | env.audio_destroy_oscillator | - |
set_oscillator_type | (oscillator_id: i32, type: wave_type) -> void | sys.audio.setOscillatorType | sys.audio.setOscillatorType | env.audio_oscillator_set_type | - |
set_oscillator_frequency | (oscillator_id: i32, frequency_hz: f32) -> void | sys.audio.setOscillatorFrequency | sys.audio.setOscillatorFrequency | env.audio_oscillator_set_frequency | - |
set_oscillator_gain | (oscillator_id: i32, gain: f32) -> void | sys.audio.setOscillatorGain | sys.audio.setOscillatorGain | env.audio_oscillator_set_gain | - |
set_oscillator_detune | (oscillator_id: i32, cents: f32) -> void | sys.audio.setOscillatorDetune | sys.audio.setOscillatorDetune | env.audio_oscillator_set_detune | - |
start_oscillator | (oscillator_id: i32) -> void | sys.audio.startOscillator | sys.audio.startOscillator | env.audio_oscillator_start | - |
stop_oscillator | (oscillator_id: i32) -> void | sys.audio.stopOscillator | sys.audio.stopOscillator | env.audio_oscillator_stop | - |
set_oscillator_envelope | (oscillator_id: i32, attack: f32, decay: f32, sustain: f32, release: f32) -> void | sys.audio.setOscillatorEnvelope | sys.audio.setOscillatorEnvelope | env.audio_oscillator_set_envelope | - |
note_on | (oscillator_id: i32) -> void | sys.audio.noteOn | sys.audio.noteOn | env.audio_oscillator_note_on | - |
note_off | (oscillator_id: i32) -> void | sys.audio.noteOff | sys.audio.noteOff | env.audio_oscillator_note_off | - |
load_buffer | (project_relative_path: string) -> i32 buffer_id; -1 on failure | sys.audio.loadBuffer | sys.audio.loadBuffer | - | - |
load_buffer_from_buffer | (encoded_audio: bytes) -> i32 buffer_id; -1 on failure | sys.audio.loadBufferFromBuffer | sys.audio.loadBufferFromBuffer | - | - |
create_buffer | (sample_rate: i32, channels: i32, sample_count: i32) -> i32 buffer_id; -1 on failure | sys.audio.createBuffer | sys.audio.createBuffer | - | - |
set_buffer_data | (buffer_id: i32, samples: f32[], offset?: i32) -> void | sys.audio.setBufferData | sys.audio.setBufferData | - | - |
destroy_buffer | (buffer_id: i32) -> void | sys.audio.destroyBuffer | sys.audio.destroyBuffer | - | - |
play_buffer | (buffer_id: i32, loop?: bool, gain?: f32) -> i32 playback_id; -1 on failure | sys.audio.playBuffer | sys.audio.playBuffer | - | - |
stop_buffer | (playback_id: i32) -> void | sys.audio.stopBuffer | sys.audio.stopBuffer | - | - |
midi_to_frequency | (midi_note: i32) -> f32 frequency_hz | sys.audio.midiToFreq | sys.audio.midiToFreq | env.audio_midi_to_freq | - |
get_error | () -> string | sys.audio.getError | sys.audio.getError | - | - |
canvas #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: web.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
path_draw | (path) -> void using current paint | sys.canvas.drawPath | sys.canvas.drawPath | env.canvas_draw_path | env.canvas_draw_path |
svg_draw | (SVG handle, x:f32, y:f32, width:f32, height:f32) -> void | sys.canvas.drawSvg | sys.canvas.drawSvg | env.canvas_draw_svg | - |
clear | (color: ARGB) -> void | sys.canvas.clear | sys.canvas.clear | env.canvas_clear | env.canvas_clear |
read_pixels | read RGBA8 premultiplied pixels | sys.canvas.readPixels | sys.canvas.readPixels | env.canvas_read_pixels | - |
draw_rect | (x:f32, y:f32, width:f32, height:f32) -> void | sys.canvas.drawRect | sys.canvas.drawRect | env.canvas_draw_rect | env.canvas_draw_rect |
draw_round_rect | (x:f32, y:f32, width:f32, height:f32, rx:f32, ry:f32) -> void | sys.canvas.drawRoundRect | sys.canvas.drawRoundRect | env.canvas_draw_round_rect | env.canvas_draw_round_rect |
draw_circle | (cx:f32, cy:f32, radius:f32) -> void | sys.canvas.drawCircle | sys.canvas.drawCircle | env.canvas_draw_circle | env.canvas_draw_circle |
draw_oval | (x:f32, y:f32, width:f32, height:f32) -> void | sys.canvas.drawOval | sys.canvas.drawOval | env.canvas_draw_oval | - |
draw_line | (x1:f32, y1:f32, x2:f32, y2:f32) -> void | sys.canvas.drawLine | sys.canvas.drawLine | env.canvas_draw_line | env.canvas_draw_line |
draw_point | (x:f32, y:f32) -> void | sys.canvas.drawPoint | sys.canvas.drawPoint | env.canvas_draw_point | - |
draw_text | draw UTF-8 text and return its width | sys.canvas.drawText | sys.canvas.drawText | env.canvas_draw_text | env.canvas_draw_text |
measure_text | measure UTF-8 text width | sys.canvas.measureText | sys.canvas.measureText | env.canvas_measure_text | - |
measure_text_rect | measure UTF-8 text bounds | sys.canvas.measureTextRect | sys.canvas.measureTextRect | env.canvas_measure_text_rect | - |
draw_arc | (x:f32, y:f32, width:f32, height:f32, start_degrees:f32, sweep_degrees:f32, use_center:bool) -> void | sys.canvas.drawArc | sys.canvas.drawArc | env.canvas_draw_arc | - |
font_set | (registered name or null) -> void | sys.canvas.setFont | sys.canvas.setFont | - | - |
set_fill_color | (color: ARGB) -> void and select fill style | sys.canvas.setFillColor | sys.canvas.setFillColor | env.canvas_set_fill_color | env.canvas_set_fill_color |
set_stroke_color | (color: ARGB) -> void and select stroke style | sys.canvas.setStrokeColor | sys.canvas.setStrokeColor | env.canvas_set_stroke_color | env.canvas_set_stroke_color |
set_stroke_width | (width:f32) -> void | sys.canvas.setStrokeWidth | sys.canvas.setStrokeWidth | env.canvas_set_stroke_width | env.canvas_set_stroke_width |
set_anti_alias | (enabled:bool) -> void | sys.canvas.setAntiAlias | sys.canvas.setAntiAlias | env.canvas_set_anti_alias | env.canvas_set_anti_alias |
set_alpha | (alpha:i32 clamped to 0..255) -> void | sys.canvas.setAlpha | sys.canvas.setAlpha | env.canvas_set_alpha | env.canvas_set_alpha |
set_stroke_cap | (butt|round|square) -> void | sys.canvas.setStrokeCap | sys.canvas.setStrokeCap | - | - |
set_stroke_join | (miter|round|bevel) -> void | sys.canvas.setStrokeJoin | sys.canvas.setStrokeJoin | - | - |
set_blend_mode | set a stable Skia blend-mode name or numeric ABI value | sys.canvas.setBlendMode | sys.canvas.setBlendMode | env.canvas_set_blend_mode | - |
set_image_filter | set or clear a managed blur/drop-shadow image filter | sys.canvas.setImageFilter | sys.canvas.setImageFilter | - | - |
set_color_filter | set or clear a managed matrix/blend color filter | sys.canvas.setColorFilter | sys.canvas.setColorFilter | - | - |
set_blur_filter | (sigma_x:f32, sigma_y:f32) -> void | - | - | env.canvas_set_blur_filter | - |
set_drop_shadow_filter | (dx:f32, dy:f32, sigma_x:f32, sigma_y:f32, color_argb:i32) -> void | - | - | env.canvas_set_drop_shadow_filter | - |
set_drop_shadow_only_filter | (dx:f32, dy:f32, sigma_x:f32, sigma_y:f32, color_argb:i32) -> void | - | - | env.canvas_set_drop_shadow_only_filter | - |
clear_image_filter | () -> void | - | - | env.canvas_clear_image_filter | - |
set_color_matrix_filter | (matrix_ptr:i32, matrix_len:i32) -> void; requires exactly 20 f32 values | - | - | env.canvas_set_color_matrix_filter | - |
set_blend_color_filter | (color_argb:i32, blend_mode:i32) -> void | - | - | env.canvas_set_blend_color_filter | - |
clear_color_filter | () -> void | - | - | env.canvas_clear_color_filter | - |
save | () -> void | sys.canvas.save | sys.canvas.save | env.transform_save | env.transform_save |
restore | () -> void | sys.canvas.restore | sys.canvas.restore | env.transform_restore | env.transform_restore |
translate | (dx:f32, dy:f32) -> void | sys.canvas.translate | sys.canvas.translate | env.transform_translate | env.transform_translate |
rotate | (degrees:f32) -> void; managed bindings also accept an optional pivot | sys.canvas.rotate | sys.canvas.rotate | env.transform_rotate | env.transform_rotate |
rotate_around | (degrees:f32, px:f32, py:f32) -> void | - | - | env.transform_rotate_around | - |
scale | (sx:f32, sy:f32) -> void | sys.canvas.scale | sys.canvas.scale | env.transform_scale | env.transform_scale |
skew | (sx:f32, sy:f32) -> void | sys.canvas.skew | sys.canvas.skew | env.canvas_skew | - |
reset_transform | () -> void | sys.canvas.reset | sys.canvas.reset | env.canvas_reset_transform | - |
clip_rect | (x:f32, y:f32, width:f32, height:f32) -> void | sys.canvas.clipRect | sys.canvas.clipRect | env.canvas_clip_rect | - |
canvas_texture #
JavaScript: desktop, android, web; Lua: unsupported; Wasmtime: unsupported; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
create | (width:i32, height:i32) -> CanvasTexture object with id, width, height, texture, target, and canvas | sys.graphics.createCanvasTexture | - | - | - |
resize | (width:i32, height:i32) -> void and refresh public GL metadata | CanvasTexture.resize | - | - | - |
destroy | () -> void and invalidate the object handle | CanvasTexture.destroy | - | - | - |
canvas_clear | (color?:ARGB) -> void | CanvasTexture.canvas.clear | - | - | - |
canvas_draw_rect | (x:f32, y:f32, width:f32, height:f32) -> void using the owner default paint | CanvasTexture.canvas.drawRect | - | - | - |
canvas_draw_arc | (x:f32, y:f32, width:f32, height:f32, start_angle:f32, sweep_angle:f32) -> void using the owner default paint | CanvasTexture.canvas.drawArc | - | - | - |
canvas_draw_line | (x1:f32, y1:f32, x2:f32, y2:f32) -> void using the owner default paint | CanvasTexture.canvas.drawLine | - | - | - |
canvas_draw_oval | (x:f32, y:f32, width:f32, height:f32) -> void using the owner default paint | CanvasTexture.canvas.drawOval | - | - | - |
canvas_draw_point | (x:f32, y:f32) -> void using the owner default paint | CanvasTexture.canvas.drawPoint | - | - | - |
canvas_draw_round_rect | (x:f32, y:f32, width:f32, height:f32, radiusX:f32, radiusY:f32) -> void using the owner default paint | CanvasTexture.canvas.drawRoundRect | - | - | - |
canvas_measure_text | (text:string, font_size?:f32) -> number width using the owner active font | CanvasTexture.canvas.measureText | - | - | - |
canvas_measure_text_rect | (text:string, font_size?:f32) -> { width: number, height: number } using the owner active font | CanvasTexture.canvas.measureTextRect | - | - | - |
canvas_read_pixels | () -> Uint8Array using the owner default paint | CanvasTexture.canvas.readPixels | - | - | - |
canvas_draw_circle | (cx:f32, cy:f32, radius:f32) -> void using the owner default paint | CanvasTexture.canvas.drawCircle | - | - | - |
canvas_draw_text | (text:string, x:f32, y:f32, font_size?:f32) -> number width using the owner active font and default paint | CanvasTexture.canvas.drawText | - | - | - |
set_fill_color | (color: ARGB) -> void and select fill style | CanvasTexture.canvas.setFillColor | - | - | - |
set_stroke_color | (color: ARGB) -> void and select stroke style | CanvasTexture.canvas.setStrokeColor | - | - | - |
set_stroke_width | (width:f32) -> void | CanvasTexture.canvas.setStrokeWidth | - | - | - |
set_anti_alias | (enabled:bool) -> void | CanvasTexture.canvas.setAntiAlias | - | - | - |
set_alpha | (alpha:i32 clamped to 0..255) -> void | CanvasTexture.canvas.setAlpha | - | - | - |
set_stroke_cap | (butt|round|square) -> void | CanvasTexture.canvas.setStrokeCap | - | - | - |
set_stroke_join | (miter|round|bevel) -> void | CanvasTexture.canvas.setStrokeJoin | - | - | - |
set_blend_mode | set a stable Skia blend-mode name or numeric ABI value | CanvasTexture.canvas.setBlendMode | - | - | - |
set_image_filter | set or clear a managed blur/drop-shadow image filter | CanvasTexture.canvas.setImageFilter | - | - | - |
set_color_filter | set or clear a managed matrix/blend color filter | CanvasTexture.canvas.setColorFilter | - | - | - |
font_set | (registered name or null) -> void | CanvasTexture.canvas.setFont | - | - | - |
capabilities #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
neural | () -> bool | sys.capabilities.neural | sys.capabilities.neural | env.capability_neural | - |
llamacpp | () -> bool | sys.capabilities.llamacpp | sys.capabilities.llamacpp | env.capability_llamacpp | - |
midi | () -> bool | sys.capabilities.midi | sys.capabilities.midi | env.capability_midi | - |
udp | () -> bool | sys.capabilities.udp | sys.capabilities.udp | env.capability_udp | - |
http | () -> bool | sys.capabilities.http | sys.capabilities.http | env.capability_http | - |
sensors | () -> bool | sys.capabilities.sensors | sys.capabilities.sensors | env.capability_sensors | - |
console #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
log | (...values) -> void | console.log | console.log | - | - |
log_int | (value:i32) -> void | - | - | env.log_int | - |
log_float | (value:f32) -> void | - | - | env.log_float | - |
device #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
keep_screen_on | (bool enabled) -> bool | sys.device.keepScreenOn | sys.device.keepScreenOn | env.device_keep_screen_on | - |
drawing_resources #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: web.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
path_create | () -> path handle | sys.path.create | sys.path.create | env.path_create | env.path_create |
path_reset | (path) -> void | sys.path.reset | sys.path.reset | env.path_reset | - |
path_move_to | (path, x:f32, y:f32) -> void | sys.path.moveTo | sys.path.moveTo | env.path_move_to | env.path_move_to |
path_line_to | (path, x:f32, y:f32) -> void | sys.path.lineTo | sys.path.lineTo | env.path_line_to | env.path_line_to |
path_quad_to | (path, x1:f32, y1:f32, x2:f32, y2:f32) -> void | sys.path.quadTo | sys.path.quadTo | env.path_quad_to | - |
path_cubic_to | (path, x1:f32, y1:f32, x2:f32, y2:f32, x3:f32, y3:f32) -> void | sys.path.cubicTo | sys.path.cubicTo | env.path_cubic_to | - |
path_close | (path) -> void | sys.path.close | sys.path.close | env.path_close | env.path_close |
path_add_rect | (path, x:f32, y:f32, width:f32, height:f32) -> void | sys.path.addRect | sys.path.addRect | env.path_add_rect | - |
path_add_circle | (path, cx:f32, cy:f32, radius:f32) -> void | sys.path.addCircle | sys.path.addCircle | env.path_add_circle | - |
svg_load | (safe project-relative path) -> SVG handle or -1 | sys.svg.load | sys.svg.load | env.svg_load | - |
svg_load_from_buffer | (SVG XML bytes) -> SVG handle or -1 | sys.svg.loadFromBuffer | sys.svg.loadFromBuffer | env.svg_load_from_buffer | - |
svg_destroy | (SVG handle) -> void | sys.svg.destroy | sys.svg.destroy | env.svg_destroy | - |
svg_get_width | (SVG handle) -> f32 | sys.svg.getWidth | sys.svg.getWidth | env.svg_get_width | - |
svg_get_height | (SVG handle) -> f32 | sys.svg.getHeight | sys.svg.getHeight | env.svg_get_height | - |
font_load | (safe project-relative path, optional name) -> void | sys.font.load | sys.font.load | - | - |
font_load_from_buffer | (font bytes, optional name) -> void | sys.font.loadFromBuffer | sys.font.loadFromBuffer | - | - |
file #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
list | (path?: string) -> file_entry[]|null | sys.files.listsys.assets.list | sys.files.listsys.assets.list | env.files_list_json | - |
read_text | (path: string) -> string|null | sys.files.readTextsys.assets.readText | sys.files.readTextsys.assets.readText | env.files_read_text | - |
read_binary | (path: string) -> bytes|null | sys.files.readBinarysys.assets.readBinary | sys.files.readBinarysys.assets.readBinary | env.files_read_binary | - |
exists | (path: string) -> bool | sys.files.existssys.assets.exists | sys.files.existssys.assets.exists | env.files_exists | - |
is_directory | (path: string) -> bool | sys.files.isDirectorysys.assets.isDirectory | sys.files.isDirectorysys.assets.isDirectory | env.files_is_directory | - |
size | (path: string) -> integer|null | sys.files.sizesys.assets.size | sys.files.sizesys.assets.size | env.files_size | - |
write_text | (path: files/ virtual path, text: string) -> absolute_path|null | sys.files.writeText | sys.files.writeText | - | - |
write_binary | (path: files/ virtual path, data: bytes) -> absolute_path|null | sys.files.writeBinary | sys.files.writeBinary | - | - |
append_binary | (path: files/ virtual path, data: bytes) -> absolute_path|null | sys.files.appendBinary | - | - | - |
pick_text | (callback, extension?: string) -> bool | sys.files.pickText | - | - | - |
save_text | (name: string, text: string, callback) -> bool | sys.files.saveText | - | - | - |
get_error | () -> string | sys.files.getErrorsys.assets.getError | sys.files.getErrorsys.assets.getError | - | - |
gl #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: web.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
create_program | compile/link vertex and fragment shader files -> positive program id or -1 | sys.gl.createProgram | sys.gl.createProgram | env.gl_create_program | env.gl_create_program |
create_program_from_buffer | compile/link in-memory vertex and fragment source -> positive program id or -1 | sys.gl.createProgramFromBuffer | sys.gl.createProgramFromBuffer | env.gl_create_program_from_buffer | - |
destroy_program | (program_id:i32) -> bool | sys.gl.destroyProgram | sys.gl.destroyProgram | env.gl_destroy_program | - |
use_program | (program_id:i32) -> bool | sys.gl.useProgram | sys.gl.useProgram | env.gl_use_program | - |
bind_screen | () -> bool; bind default framebuffer and viewport | sys.gl.bindScreen | sys.gl.bindScreen | env.gl_bind_screen | - |
bind_render_target | (target_id:i32) -> bool; zero binds screen | sys.gl.bindRenderTarget | sys.gl.bindRenderTarget | env.gl_bind_render_target | - |
draw_fullscreen | (program_id:i32) -> bool using the queued/default-canvas path | sys.gl.drawFullscreen | - | - | env.gl_draw_fullscreen |
draw_fullscreen_immediate | (program_id:i32, source_texture:u32) -> bool against current target | sys.gl.drawFullscreenImmediate | sys.gl.drawFullscreen | env.gl_draw_fullscreen | - |
set_uniform_1i | (program_id, name, i32) -> bool | sys.gl.setUniform1i | sys.gl.setUniform1i | env.gl_set_uniform_1i | - |
set_uniform_1f | (program_id, name, f32) -> bool | sys.gl.setUniform1f | sys.gl.setUniform1f | env.gl_set_uniform_1f | env.gl_set_uniform_1f |
set_uniform_2f | (program_id, name, f32, f32) -> bool | sys.gl.setUniform2f | sys.gl.setUniform2f | env.gl_set_uniform_2f | env.gl_set_uniform_2f |
set_uniform_3f | (program_id, name, f32, f32, f32) -> bool | sys.gl.setUniform3f | sys.gl.setUniform3f | env.gl_set_uniform_3f | - |
set_uniform_4f | (program_id, name, f32, f32, f32, f32) -> bool | sys.gl.setUniform4f | sys.gl.setUniform4f | env.gl_set_uniform_4f | - |
get_last_error | () -> last GL error string or empty | sys.gl.getLastError | sys.gl.getLastError | - | - |
get_project_dir | () -> loaded project directory | sys.gl.getProjectDir | sys.gl.getProjectDir | - | - |
create_render_target | (width:i32, height:i32, depth:bool) -> target id or -1 | sys.gl.createRenderTarget | sys.gl.createRenderTarget | env.gl_create_render_target | - |
destroy_render_target | (target_id:i32) -> bool | sys.gl.destroyRenderTarget | sys.gl.destroyRenderTarget | env.gl_destroy_render_target | - |
resize_render_target | (target_id:i32, width:i32, height:i32) -> bool | sys.gl.resizeRenderTarget | sys.gl.resizeRenderTarget | env.gl_resize_render_target | - |
draw_region | queued region draw using program and optional target | sys.gl.drawRegion | - | - | - |
draw_region_immediate | immediate region draw against current or explicit target | sys.gl.drawRegionImmediate | sys.gl.drawRegion | env.gl_draw_region | - |
bind_render_target_texture | queued bind of render-target color texture to sampler | sys.gl.bindTexture | - | - | - |
bind_render_target_texture_immediate | immediate bind of render-target color texture to sampler | sys.gl.renderTargetTexture | sys.gl.bindTexture | env.gl_bind_texture | - |
bind_canvas_texture | queued bind of flushed CanvasTexture to sampler | sys.gl.bindCanvasTexture | - | - | - |
program_texture | polymorphic immediate binding of numeric 2D texture or CanvasTexture | sys.gl.texture | - | - | - |
create_buffer | () -> buffer id or -1; managed forms optionally upload initial data | sys.gl.createBuffer | sys.gl.createBuffer | env.gl_create_buffer | env.gl_create_buffer |
buffer_data | (buffer_id, target, data, byte_len, usage) -> bool | - | - | env.gl_buffer_data | env.gl_buffer_data |
update_buffer | (buffer_id, byte_offset, data, byte_len) -> bool | sys.gl.updateBuffer | sys.gl.updateBuffer | env.gl_buffer_sub_data | - |
destroy_buffer | (buffer_id:i32) -> bool | sys.gl.destroyBuffer | sys.gl.destroyBuffer | env.gl_destroy_buffer | - |
create_texture_2d | (width, height, format, optional RGBA bytes) -> texture id or -1 | sys.gl.createTexture2D | sys.gl.createTexture2D | env.gl_create_texture_2d | - |
load_texture_2d | (safe project-relative image path) -> texture id or -1 | sys.gl.loadTexture2D | sys.gl.loadTexture2D | env.gl_load_texture_2d | - |
load_texture_2d_from_buffer | (encoded image bytes) -> texture id or -1 | sys.gl.loadTexture2DFromBuffer | sys.gl.loadTexture2DFromBuffer | env.gl_load_texture_2d_from_buffer | - |
load_texture_cube | (six safe project-relative image paths) -> cubemap id or -1 | sys.gl.loadTextureCube | sys.gl.loadTextureCube | env.gl_load_texture_cube | - |
load_texture_cube_from_buffer | (six encoded image buffers) -> cubemap id or -1 | sys.gl.loadTextureCubeFromBuffer | sys.gl.loadTextureCubeFromBuffer | env.gl_load_texture_cube_from_buffer | - |
update_texture_2d | (texture_id, x, y, width, height, pixels) -> bool | sys.gl.updateTexture2D | sys.gl.updateTexture2D | env.gl_update_texture_2d | - |
destroy_texture | (texture_id:i32) -> bool | sys.gl.destroyTexture | sys.gl.destroyTexture | env.gl_destroy_texture | - |
create_vertex_layout | () -> layout id or -1 | sys.gl.createVertexLayout | sys.gl.createVertexLayout | env.gl_create_vertex_layout | env.gl_create_vertex_layout |
destroy_vertex_layout | (layout_id:i32) -> bool | sys.gl.destroyVertexLayout | sys.gl.destroyVertexLayout | env.gl_destroy_vertex_layout | - |
set_attribute | configure one vertex attribute slot | sys.gl.setAttribute | sys.gl.setAttribute | env.gl_set_attribute | env.gl_set_attribute |
set_index_buffer | attach an index buffer and u16/u32 type to a layout | sys.gl.setIndexBuffer | sys.gl.setIndexBuffer | env.gl_set_index_buffer | env.gl_set_index_buffer |
set_uniform_matrix3 | set one or more column-major mat3 values | sys.gl.setUniformMatrix3 | sys.gl.setUniformMatrix3 | env.gl_set_uniform_matrix3fv | - |
set_uniform_matrix4 | set one or more column-major mat4 values | sys.gl.setUniformMatrix4 | sys.gl.setUniformMatrix4 | env.gl_set_uniform_matrix4fv | env.gl_set_uniform_matrix4fv |
set_uniform_1iv | set i32 uniform array | sys.gl.setUniform1iv | sys.gl.setUniform1iv | env.gl_set_uniform_1iv | - |
set_uniform_1fv | set scalar f32 uniform array | sys.gl.setUniform1fv | sys.gl.setUniform1fv | env.gl_set_uniform_1fv | - |
set_uniform_2fv | set vec2 f32 uniform array | sys.gl.setUniform2fv | sys.gl.setUniform2fv | env.gl_set_uniform_2fv | - |
set_uniform_3fv | set vec3 f32 uniform array | sys.gl.setUniform3fv | sys.gl.setUniform3fv | env.gl_set_uniform_3fv | - |
set_uniform_4fv | set vec4 f32 uniform array | sys.gl.setUniform4fv | sys.gl.setUniform4fv | env.gl_set_uniform_4fv | - |
bind_texture_2d | queued bind of app 2D texture to sampler | sys.gl.bindTexture2D | - | - | - |
bind_texture_2d_immediate | immediate bind of app 2D texture to sampler | - | sys.gl.bindTexture2D | env.gl_bind_texture_2d | - |
bind_texture_cube | queued bind of app cubemap to sampler | sys.gl.bindTextureCube | - | - | - |
bind_texture_cube_immediate | immediate bind of app cubemap to sampler | - | sys.gl.bindTextureCube | env.gl_bind_texture_cube | - |
draw_mesh | queued mesh draw with layout and draw state | sys.gl.drawMesh | - | - | - |
draw_mesh_immediate | immediate mesh draw with optional target, depth/cull/blend state, and instance count | sys.gl.drawMeshImmediate | sys.gl.drawMesh | env.gl_draw_mesh | env.gl_draw_mesh |
get_attrib_location | (program_id, name) -> location or -1 | sys.gl.getAttribLocation | sys.gl.getAttribLocation | env.gl_get_attrib_location | - |
input_window #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: web.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
input_snapshot | () -> per-frame input snapshot containing mouse, pointer(s), modifiers, text/edit/composition, timing, frame count, and focus | sys.input.get | sys.input.get | - | - |
key_down | (SDL scancode:i32) -> bool currently held | sys.input.isKeyDown | sys.input.isKeyDown | env.input_get_key_down | - |
key_pressed | (SDL scancode:i32) -> bool pressed during current frame | sys.input.isKeyPressed | sys.input.isKeyPressed | - | - |
start_text_input | (text, UTF-16 selection start/end, multiline) -> bool | sys.input.startTextInput | sys.input.startTextInput | - | - |
update_text_input | (text, UTF-16 selection start/end, caret x/y/width/height) -> bool | sys.input.updateTextInput | sys.input.updateTextInput | - | - |
stop_text_input | () -> void; finish composition and platform editing session | sys.input.stopTextInput | sys.input.stopTextInput | - | - |
window_width | () -> physical canvas width in pixels | sys.window.getWidth | sys.window.getWidth | env.window_get_width | env.window_get_width |
window_height | () -> physical canvas height in pixels | sys.window.getHeight | sys.window.getHeight | env.window_get_height | env.window_get_height |
display_density | () -> f32 drawable-pixel density; defaults to 1 | sys.window.getDisplayDensity | sys.window.getDisplayDensity | env.window_get_display_density | - |
mouse_x | () -> i32 current mouse x | - | - | env.input_get_mouse_x | env.input_get_mouse_x |
mouse_y | () -> i32 current mouse y | - | - | env.input_get_mouse_y | env.input_get_mouse_y |
mouse_button | (button:i32) -> i32 boolean | - | - | env.input_get_mouse_button | env.input_get_mouse_button |
delta_time | () -> f32 elapsed seconds since previous frame or 0 | - | - | env.input_get_delta_time | - |
total_time | () -> f32 elapsed seconds since runtime start or 0 | - | - | env.input_get_total_time | - |
llamacpp #
JavaScript: desktop, android; Lua: desktop, android; Wasmtime: unsupported; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
is_available | () -> bool | sys.llamacpp.isAvailable | sys.llamacpp.isAvailable | - | - |
get_devices | () -> device[] | sys.llamacpp.getDevices | sys.llamacpp.getDevices | - | - |
load_model | (path, options, callback) -> void | sys.llamacpp.loadModel | sys.llamacpp.loadModel | - | - |
get_error | () -> string | sys.llamacpp.getError | sys.llamacpp.getError | - | - |
magneto #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
is_available | () -> bool | sys.sensors.isAvailable | sys.sensors.isAvailable | env.magneto_is_available | - |
has_accelerometer | () -> bool | sys.sensors.hasAccelerometer | sys.sensors.hasAccelerometer | env.magneto_has_accelerometer | - |
has_compass | () -> bool | sys.sensors.hasCompass | sys.sensors.hasCompass | env.magneto_has_compass | - |
start | () -> bool | sys.sensors.start | sys.sensors.start | env.magneto_start | - |
stop | () -> void | sys.sensors.stop | sys.sensors.stop | env.magneto_stop | - |
is_active | () -> bool | sys.sensors.isActive | sys.sensors.isActive | env.magneto_is_active | - |
get_accel | () -> {x: f32, y: f32, z: f32}|null | sys.sensors.getAccel | sys.sensors.getAccel | env.magneto_get_accel_xenv.magneto_get_accel_yenv.magneto_get_accel_z | - |
get_compass | () -> {x: f32, y: f32, z: f32, heading: f32}|null | sys.sensors.getCompass | sys.sensors.getCompass | env.magneto_get_compass_xenv.magneto_get_compass_yenv.magneto_get_compass_zenv.magneto_get_compass_heading | - |
math #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: web.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
mat4_identity | (out: mat4) -> void | sys.math.mat4Identity | sys.math.mat4Identity | env.math_mat4_identity | env.math_mat4_identity |
mat4_multiply | (out: mat4, a: mat4, b: mat4) -> void | sys.math.mat4Multiply | sys.math.mat4Multiply | env.math_mat4_multiply | env.math_mat4_multiply |
mat4_perspective | (out: mat4, fovy: f32, aspect: f32, near: f32, far: f32) -> void | sys.math.mat4Perspective | sys.math.mat4Perspective | env.math_mat4_perspective | env.math_mat4_perspective |
mat4_ortho | (out: mat4, left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32) -> void | sys.math.mat4Ortho | sys.math.mat4Ortho | env.math_mat4_ortho | - |
mat4_lookat | (out: mat4, eye: vec3, target: vec3, up: vec3) -> void | sys.math.mat4LookAt | sys.math.mat4LookAt | env.math_mat4_lookat | env.math_mat4_lookat |
mat4_translate | (out: mat4, a: mat4, translation: vec3) -> void | sys.math.mat4Translate | sys.math.mat4Translate | env.math_mat4_translate | - |
mat4_rotate_x | (out: mat4, a: mat4, angle: f32) -> void | sys.math.mat4RotateX | sys.math.mat4RotateX | env.math_mat4_rotate_x | env.math_mat4_rotate_x |
mat4_rotate_y | (out: mat4, a: mat4, angle: f32) -> void | sys.math.mat4RotateY | sys.math.mat4RotateY | env.math_mat4_rotate_y | env.math_mat4_rotate_y |
mat4_rotate_z | (out: mat4, a: mat4, angle: f32) -> void | sys.math.mat4RotateZ | sys.math.mat4RotateZ | env.math_mat4_rotate_z | - |
mat4_scale | (out: mat4, a: mat4, scale: vec3) -> void | sys.math.mat4Scale | sys.math.mat4Scale | env.math_mat4_scale | - |
mat4_invert | (out: mat4, a: mat4) -> bool | sys.math.mat4Invert | sys.math.mat4Invert | env.math_mat4_invert | - |
mat4_transpose | (out: mat4, a: mat4) -> void | sys.math.mat4Transpose | sys.math.mat4Transpose | env.math_mat4_transpose | - |
vec3_add | (out: vec3, a: vec3, b: vec3) -> void | sys.math.vec3Add | sys.math.vec3Add | env.math_vec3_add | - |
vec3_sub | (out: vec3, a: vec3, b: vec3) -> void | sys.math.vec3Sub | sys.math.vec3Sub | env.math_vec3_sub | - |
vec3_scale | (out: vec3, a: vec3, scale: f32) -> void | sys.math.vec3Scale | sys.math.vec3Scale | env.math_vec3_scale | - |
vec3_normalize | (out: vec3, a: vec3) -> void | sys.math.vec3Normalize | sys.math.vec3Normalize | env.math_vec3_normalize | - |
vec3_cross | (out: vec3, a: vec3, b: vec3) -> void | sys.math.vec3Cross | sys.math.vec3Cross | env.math_vec3_cross | - |
vec3_dot | (a: vec3, b: vec3) -> f32 | sys.math.vec3Dot | sys.math.vec3Dot | env.math_vec3_dot | - |
vec3_length | (a: vec3) -> f32 | sys.math.vec3Length | sys.math.vec3Length | env.math_vec3_length | - |
vec3_transform_mat4 | (out: vec3, value: vec3, matrix: mat4) -> void | sys.math.vec3TransformMat4 | sys.math.vec3TransformMat4 | env.math_vec3_transform_mat4 | - |
vec3_normalize_many | (out: vec3[], values: vec3[], count: i32) -> void | sys.math.vec3NormalizeMany | sys.math.vec3NormalizeMany | - | - |
vec3_transform_mat4_many | (out: vec3[], values: vec3[], matrix: mat4, count: i32) -> void | sys.math.vec3TransformMat4Many | sys.math.vec3TransformMat4Many | - | - |
quat_from_axis_angle | (out: quat, axis: vec3, angle: f32) -> void | sys.math.quatFromAxisAngle | sys.math.quatFromAxisAngle | env.math_quat_from_axis_angle | - |
quat_multiply | (out: quat, a: quat, b: quat) -> void | sys.math.quatMultiply | sys.math.quatMultiply | env.math_quat_multiply | - |
quat_slerp | (out: quat, a: quat, b: quat, t: f32) -> void | sys.math.quatSlerp | sys.math.quatSlerp | env.math_quat_slerp | - |
quat_to_mat4 | (out: mat4, value: quat) -> void | sys.math.quatToMat4 | sys.math.quatToMat4 | env.math_quat_to_mat4 | - |
midi #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
get_input_count | () -> integer; 0 when unavailable or no devices | sys.midi.getInputCount | sys.midi.getInputCount | env.midi_get_input_count | - |
get_output_count | () -> integer; 0 when unavailable or no devices | sys.midi.getOutputCount | sys.midi.getOutputCount | env.midi_get_output_count | - |
get_input_devices | () -> Array<{id: integer, name: string}>; [] when unavailable | sys.midi.getInputDevices | sys.midi.getInputDevices | - | - |
get_output_devices | () -> Array<{id: integer, name: string}>; [] when unavailable | sys.midi.getOutputDevices | sys.midi.getOutputDevices | - | - |
refresh_devices | () -> void; no-op when unavailable | sys.midi.refreshDevices | sys.midi.refreshDevices | - | - |
on_devices_changed | (callback: (event: {inputs, outputs, generation}) -> void | null) -> void | sys.midi.onDevicesChanged | sys.midi.onDevicesChanged | - | - |
open_input | (device_index: integer, callback: (message) -> void) -> integer handle; -1 on failure | sys.midi.openInput | sys.midi.openInput | - | - |
close_input | (handle: integer) -> void; no-op when unavailable | sys.midi.closeInput | sys.midi.closeInput | - | - |
open_output | (device_index: integer) -> integer handle; -1 on failure | sys.midi.openOutput | sys.midi.openOutput | env.midi_open_output | - |
close_output | (handle: integer) -> void; no-op when unavailable | sys.midi.closeOutput | sys.midi.closeOutput | env.midi_close_output | - |
send_message | (handle: integer, status: byte, data1: byte, data2: byte) -> bool | sys.midi.sendMessage | sys.midi.sendMessage | env.midi_send_message | - |
send_raw | (handle: integer, data: bytes[1..4096]) -> bool | sys.midi.sendRaw | sys.midi.sendRaw | env.midi_send_raw | - |
note_on | (handle: integer, channel: integer, note: integer, velocity: integer) -> bool | sys.midi.noteOn | sys.midi.noteOn | env.midi_note_on | - |
note_off | (handle: integer, channel: integer, note: integer, velocity: integer) -> bool | sys.midi.noteOff | sys.midi.noteOff | env.midi_note_off | - |
control_change | (handle: integer, channel: integer, control: integer, value: integer) -> bool | sys.midi.controlChange | sys.midi.controlChange | env.midi_control_change | - |
program_change | (handle: integer, channel: integer, program: integer) -> bool | sys.midi.programChange | sys.midi.programChange | env.midi_program_change | - |
pitch_bend | (handle: integer, channel: integer, value: integer[-8192..8191]) -> bool | sys.midi.pitchBend | sys.midi.pitchBend | env.midi_pitch_bend | - |
channel_pressure | (handle: integer, channel: integer, pressure: integer) -> bool | sys.midi.channelPressure | sys.midi.channelPressure | - | - |
poly_pressure | (handle: integer, channel: integer, note: integer, pressure: integer) -> bool | sys.midi.polyPressure | sys.midi.polyPressure | - | - |
get_type | (status: byte) -> integer message_type | sys.midi.getType | sys.midi.getType | - | - |
get_channel | (status: byte) -> integer[0..15] | -1 for system messages | sys.midi.getChannel | sys.midi.getChannel | - | - |
create_session | (name: string, control_port?: integer = 0) -> integer handle; -1 on failure or unavailable | sys.midi.createSession | sys.midi.createSession | env.rtpmidi_create_session | - |
connect_session | (session: integer, host: string, control_port: integer) -> bool invitation_sent | sys.midi.connectSession | sys.midi.connectSession | env.rtpmidi_connect | - |
destroy_session | (session: integer) -> void; no-op when unavailable | sys.midi.destroySession | sys.midi.destroySession | env.rtpmidi_destroy_session | - |
on_session_message | (session: integer, callback: (message) -> void) -> void; no-op when unavailable or session is outside 0..7 | sys.midi.onSessionMessage | sys.midi.onSessionMessage | - | - |
session_send | (session: integer, status: byte, data1: byte, data2: byte) -> bool; true only when sent to at least one peer | sys.midi.sessionSend | sys.midi.sessionSend | env.rtpmidi_send_message | - |
session_note_on | (session: integer, channel: integer, note: integer, velocity: integer) -> bool | sys.midi.sessionNoteOn | sys.midi.sessionNoteOn | - | - |
session_note_off | (session: integer, channel: integer, note: integer, velocity: integer) -> bool | sys.midi.sessionNoteOff | sys.midi.sessionNoteOff | - | - |
session_control_change | (session: integer, channel: integer, control: integer, value: integer) -> bool | sys.midi.sessionControlChange | sys.midi.sessionControlChange | - | - |
session_send_raw | (session: integer, data: bytes[1..512]) -> bool | sys.midi.sessionSendRaw | sys.midi.sessionSendRaw | - | - |
get_sessions | () -> Array<{handle, name, port, state, peerCount}>; [] when unavailable | sys.midi.getSessions | sys.midi.getSessions | - | - |
get_session_count | () -> integer; 0 when unavailable | - | - | env.rtpmidi_get_session_count | - |
module_lifecycle #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: web.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
module_import | load another language module | language.import | language.require | - | - |
load_entrypoint | load and execute the configured application entrypoint | runtime.entrypoint | runtime.entrypoint | runtime.entrypoint | runtime.entrypoint |
guest_memory | guest-exported linear memory used by pointer/buffer host ABIs | - | - | guest.exports.memory | guest.exports.memory |
guest_init | optional guest export init() called once after instantiation and memory wiring | - | - | guest.exports.init | guest.exports.init |
exit | end the application with an exit status | runtime.exit | runtime.exit | runtime.app_exit | runtime.app_exit |
network #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: web.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
fetch | asynchronous policy-controlled HTTP request | sys.net.fetch | sys.net.fetchglobal.fetch | env.network_fetch | env.network_fetch |
parse_json | (json_text: string) -> Lua value | - | global.json_parse | - | - |
headers_get | (name: string) -> string|null | Headers.get | - | - | - |
headers_has | (name: string) -> bool | Headers.has | - | - | - |
headers_entries | () -> Array<[string,string]> | Headers.entries | - | - | - |
headers_keys | () -> string[] | Headers.keys | - | - | - |
headers_values | () -> string[] | Headers.values | - | - | - |
headers_for_each | (callback: (value: string, name: string) -> any) -> void | Headers.forEach | - | - | - |
response_text | () -> string; consumes the body once | Response.text | - | - | - |
response_json | () -> any; consumes the body once and throws SyntaxError for invalid JSON | Response.json | - | - | - |
response_array_buffer | () -> ArrayBuffer; consumes the body once | Response.arrayBuffer | - | - | - |
fetch_status | (slot: i32) -> request state | - | - | env.network_fetch_status | env.network_fetch_status |
fetch_status_code | (slot: i32) -> HTTP status sentinel | - | - | env.network_fetch_status_code | env.network_fetch_status_code |
fetch_response_body_length | (slot: i32) -> body byte length sentinel | - | - | env.network_fetch_response_body_len | env.network_fetch_response_body_len |
fetch_response_body | (slot: i32, destination_ptr: i32, max_len: i32) -> i32 bytes copied | - | - | env.network_fetch_response_body | env.network_fetch_response_body |
fetch_response_headers_length | (slot: i32) -> serialized header byte length | - | - | env.network_fetch_response_headers_len | - |
fetch_response_headers | (slot: i32, destination_ptr: i32, max_len: i32) -> serialized header bytes copied | - | - | env.network_fetch_response_headers | - |
fetch_response_url_length | (slot: i32) -> final URL byte length | - | - | env.network_fetch_response_url_len | - |
fetch_response_url | (slot: i32, destination_ptr: i32, max_len: i32) -> final URL bytes copied | - | - | env.network_fetch_response_url | - |
fetch_error_length | (slot: i32) -> request error byte length | - | - | env.network_fetch_error_len | - |
fetch_error | (slot: i32, destination_ptr: i32, max_len: i32) -> request error bytes copied | - | - | env.network_fetch_error | - |
fetch_release | (slot: i32) -> void | - | - | env.network_fetch_release | env.network_fetch_release |
neural #
JavaScript: desktop, android; Lua: desktop, android; Wasmtime: desktop; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
is_available | () -> bool indicating whether the ONNX Runtime library can be loaded | sys.neural.isAvailable | sys.neural.isAvailable | env.neural_is_available | - |
get_error | () -> last context error string | sys.neural.getError | sys.neural.getError | env.neural_get_error | - |
load_model | (safe project-relative .onnx path) -> model_id | sys.neural.loadModel | sys.neural.loadModel | env.neural_load_model | - |
load_model_from_buffer | (ONNX model bytes) -> model_id | sys.neural.loadModelFromBuffer | sys.neural.loadModelFromBuffer | env.neural_load_model_from_buffer | - |
unload_model | (model_id) -> void | sys.neural.unloadModel | sys.neural.unloadModel | env.neural_unload_model | - |
get_model_info | (model_id) -> model metadata | sys.neural.getModelInfo | sys.neural.getModelInfo | - | - |
get_input_count | (model_id) -> input tensor count | - | - | env.neural_get_input_count | - |
get_output_count | (model_id) -> output tensor count | - | - | env.neural_get_output_count | - |
get_input_info | (model_id, input_index) -> input name, shape, and rank | - | - | env.neural_get_input_info | - |
get_output_info | (model_id, output_index) -> output name, shape, and rank | - | - | env.neural_get_output_info | - |
set_input | stage a named tensor for the next inference | sys.neural.setInput | sys.neural.setInput | env.neural_set_input_f32 | - |
run | run synchronous model inference | sys.neural.run | sys.neural.run | env.neural_run | - |
get_output | retrieve a named output from the most recent run | sys.neural.getOutput | sys.neural.getOutput | env.neural_copy_output_f32env.neural_get_output_f32 | - |
get_output_shape | retrieve the resolved shape of a named output | - | - | env.neural_get_output_shape | - |
scheduling #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: web.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
animation_start | (callback(timestamp_ms)) -> void; replace the persistent Lua frame callback | - | sys.animation.start | - | - |
request_frame | (callback(timestamp_ms)) -> handle 1; replace the persistent managed frame callback | sys.animation.requestFrame | sys.animation.requestFrame | - | - |
cancel_frame | (handle ignored) -> void; clear the single managed frame callback | sys.animation.cancelFrame | sys.animation.cancelFrame | - | - |
timer_once | (delay_ms:number, callback) -> timer id or undefined; non-positive delay fires on a later timer-processing pass | sys.timer.once | - | - | - |
timer_every | (interval_ms:number, callback) -> timer id or undefined; interval is clamped to at least 1 ms | sys.timer.every | - | - | - |
timer_clear | (timer_id:i32) -> void; unknown or inactive ids are ignored | sys.timer.clear | - | - | - |
guest_frame | optional guest export frame(timestamp_ms); invoked once per host frame | - | - | guest.exports.frame | guest.exports.frame |
sqlite #
JavaScript: desktop, android, web; Lua: desktop, android, web; Wasmtime: desktop; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
open | (name: string) -> database_handle | sys.db.open | sys.db.open | env.db_open | - |
close | (handle: database_handle) -> void | sys.db.close | sys.db.close | env.db_close | - |
execute | (handle: database_handle, sql: string) -> bool | sys.db.execute | sys.db.execute | env.db_execute | - |
run | (handle: database_handle, sql: string, ...params: null|bool|number|string) -> i32 changes | sys.db.run | sys.db.run | env.db_run | - |
run_integer_parameter | (handle: database_handle, sql: string, parameter: i32) -> i32 changes | - | - | env.db_run_int | - |
run_string_parameter | (handle: database_handle, sql: string, parameter: string) -> i32 changes | - | - | env.db_run_str | - |
query | (handle: database_handle, sql: string, ...params: null|bool|number|string) -> rows | sys.db.query | sys.db.query | env.db_query_json | - |
last_insert_id | (handle: database_handle) -> integer | sys.db.lastInsertId | sys.db.lastInsertId | env.db_last_insert_id | - |
get_error | () -> string | sys.db.getError | sys.db.getError | - | - |
udp #
JavaScript: desktop, android; Lua: desktop, android; Wasmtime: desktop; Browser WASM: unsupported.
| Operation | Signature | JavaScript | Lua | Wasmtime | Browser WASM |
|---|---|---|---|---|---|
bind | (local_port: i32; 0 requests auto-assignment) -> i32 socket_handle; -1 on failure | sys.net.udp.bind | sys.net.udp.bind | env.udp_bind | - |
get_port | (socket_handle: i32) -> i32 local_port; -1 on failure | sys.net.udp.getPort | sys.net.udp.getPort | env.udp_get_port | - |
send | (socket_handle: i32, host: string, port: i32, data: bytes) -> bool | sys.net.udp.send | sys.net.udp.send | env.udp_send | - |
receive | receive datagrams with sender host and port | sys.net.udp.onMessage | sys.net.udp.onMessage | env.udp_recv | - |
close | (socket_handle: i32) -> void | sys.net.udp.close | sys.net.udp.close | env.udp_close | - |
<!-- END GENERATED API AVAILABILITY -->