Grain

  • Template: cart_grain - press "Use this template" and you have a working game.
  • Docker image: ghcr.io/notnullgames/null0-cart-grain:latest (linux/amd64 only - runs emulated on Apple Silicon)
  • Your code: cart/main.gr, compiled with grain
  • Bindings: carts/grain/null0.gr (baked into the docker image for you)
  • WASI is available, so ordinary file and stdio calls work.

building

You do not install grain - the docker image has it, and the current null0 bindings, baked in. That is the whole point: there is nothing in your project to keep in sync with the engine.

docker run --rm --user $(id -u):$(id -g) --platform linux/amd64 \
  -v ./cart:/src -v ./webroot:/out \
  ghcr.io/notnullgames/null0-cart-grain:latest mygame

The template wraps that in npm start, which also serves the result and rebuilds when you save.

Grain notes

  • from "./null0.gr" include Null0.
  • Numbers cross the boundary as raw wasm values, so they are written 100n, not 100.
  • Call Null0.initColors() first thing in load(), then Null0.blue and friends work.

a cart, in Grain

This is carts/grain/simple/main.gr in the engine repo - the same file CI builds into the cart below, so it always compiles.

module Main

// the null0-cart-grain docker image provides null0.gr; you only need to
// ship your own copy if you build outside docker
from "./null0.gr" include Null0

// called on load
@unsafe
provide let load = () => {
  Null0.initColors()
  Null0.clear(Null0.blue)
  Null0.draw_circle(100n, 100n, 50n, Null0.red)
}

// called on every frame
provide let update = () => void

// other callbacks you can implement:
// provide let unload = () => void
// @unsafe
// provide let buttonUp = (button: WasmI32, player: WasmI32) => void
// @unsafe
// provide let buttonDown = (button: WasmI32, player: WasmI32) => void
// @unsafe
// provide let keyUp = (key: WasmI32) => void
// @unsafe
// provide let keyDown = (key: WasmI32) => void
// @unsafe
// provide let mouseDown = (button: WasmI32) => void
// @unsafe
// provide let mouseUp = (button: WasmI32) => void
// @unsafe
// provide let mouseMoved = (x: WasmF32, y: WasmF32) => void
carts/grain/simple/main.gr

callbacks

A cart implements the callbacks it cares about. In Grain they look like this:

provide let load = () => { void }

See anatomy of a cart for the full list and what each one is passed.

more Grain carts

the API, in Grain

Every null0 function, spelled the way Grain spells it. These are read out of the generated bindings themselves, so they match what your editor completes.

colors (7)

Tint a color with another color.

provide foreign wasm color_tint: (WasmI32, WasmI32) => WasmI32 from "null0"

Fade a color.

provide foreign wasm color_fade: (WasmI32, WasmF32) => WasmI32 from "null0"

Change the brightness of a color.

provide foreign wasm color_brightness: (WasmI32, WasmF32) => WasmI32 from "null0"

Invert a color.

provide foreign wasm color_invert: (WasmI32) => WasmI32 from "null0"

Blend 2 colors together.

provide foreign wasm color_alpha_blend: (WasmI32, WasmI32) => WasmI32 from "null0"

Change contrast of a color.

provide foreign wasm color_contrast: (WasmI32, WasmF32) => WasmI32 from "null0"

Interpolate colors.

provide foreign wasm color_bilinear_interpolate: (WasmI32, WasmI32, WasmI32, WasmI32, WasmF32, WasmF32) => WasmI32 from "null0"
graphics (75)

Create a new blank image.

provide foreign wasm new_image: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Copy an image to a new image.

provide foreign wasm image_copy: (WasmI32) => WasmI32 from "null0"

Create an image from a region of another image.

provide foreign wasm image_subimage: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Clear the screen.

provide foreign wasm clear: (WasmI32) => Void from "null0"

Draw a single pixel on the screen.

provide foreign wasm draw_point: (WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a line on the screen.

provide foreign wasm draw_line: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled rectangle on the screen.

provide foreign wasm draw_rectangle: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled triangle on the screen.

provide foreign wasm draw_triangle: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled ellipse on the screen.

provide foreign wasm draw_ellipse: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled circle on the screen.

provide foreign wasm draw_circle: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled polygon on the screen.

provide foreign wasm draw_polygon: (WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled arc on the screen.

provide foreign wasm draw_arc: (WasmI32, WasmI32, WasmF32, WasmF32, WasmF32, WasmI32, WasmI32) => Void from "null0"

Draw a filled round-rectangle on the screen.

provide foreign wasm draw_rectangle_rounded: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw an image on the screen.

provide foreign wasm draw_image: (WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a tinted image on the screen.

provide foreign wasm draw_image_tint: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw an image, rotated, on the screen.

provide foreign wasm draw_image_rotated: (WasmI32, WasmI32, WasmI32, WasmF32, WasmF32, WasmF32, WasmI32) => Void from "null0"

Draw an image, flipped, on the screen.

provide foreign wasm draw_image_flipped: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw an image, scaled, on the screen.

provide foreign wasm draw_image_scaled: (WasmI32, WasmI32, WasmI32, WasmF32, WasmF32, WasmF32, WasmF32, WasmI32) => Void from "null0"

Draw some text on the screen.

provide foreign wasm draw_text: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Save an image to persistant storage.

provide foreign wasm save_image: (WasmI32, WasmI32) => Void from "null0"

Load an image from a file in cart.

provide foreign wasm load_image: (WasmI32) => WasmI32 from "null0"

Resize an image, return copy.

provide foreign wasm image_resize: (WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Scale an image, return copy.

provide foreign wasm image_scale: (WasmI32, WasmF32, WasmF32, WasmI32) => WasmI32 from "null0"

Replace a color in an image, in-place.

provide foreign wasm image_color_replace: (WasmI32, WasmI32, WasmI32) => Void from "null0"

Tint a color in an image, in-place.

provide foreign wasm image_color_tint: (WasmI32, WasmI32) => Void from "null0"

Fade a color in an image, in-place.

provide foreign wasm image_color_fade: (WasmI32, WasmF32) => Void from "null0"

Copy a font to a new font.

provide foreign wasm font_copy: (WasmI32) => WasmI32 from "null0"

Scale a font, return a new font.

provide foreign wasm font_scale: (WasmI32, WasmF32, WasmF32, WasmI32) => WasmI32 from "null0"

Load a BMF font from a file in cart.

provide foreign wasm load_font_bmf: (WasmI32, WasmI32) => WasmI32 from "null0"

Load a BMF font from an image.

provide foreign wasm load_font_bmf_from_image: (WasmI32, WasmI32) => WasmI32 from "null0"

Measure the size of some text.

provide foreign wasm measure_text: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Meaure an image (use 0 for screen).

provide foreign wasm measure_image: (WasmI32) => WasmI32 from "null0"

Load a TTY font from a file in cart.

provide foreign wasm load_font_tty: (WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Load a TTY font from an image.

provide foreign wasm load_font_tty_from_image: (WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Load a TTF font from a file in cart.

provide foreign wasm load_font_ttf: (WasmI32, WasmI32) => WasmI32 from "null0"

Invert the colors in an image, in-place.

provide foreign wasm image_color_invert: (WasmI32) => Void from "null0"

Calculate a rectangle representing the available alpha border in an image.

provide foreign wasm image_alpha_border: (WasmI32, WasmF32) => WasmI32 from "null0"

Crop an image, in-place.

provide foreign wasm image_crop: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Crop an image based on the alpha border, in-place.

provide foreign wasm image_alpha_crop: (WasmI32, WasmF32) => Void from "null0"

Adjust the brightness of an image, in-place.

provide foreign wasm image_color_brightness: (WasmI32, WasmF32) => Void from "null0"

Flip an image, in-place.

provide foreign wasm image_flip: (WasmI32, WasmI32, WasmI32) => Void from "null0"

Change the contrast of an image, in-place.

provide foreign wasm image_color_contrast: (WasmI32, WasmF32) => Void from "null0"

Use an image as an alpha-mask on another image.

provide foreign wasm image_alpha_mask: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Create a new image, rotating another image.

provide foreign wasm image_rotate: (WasmI32, WasmF32, WasmI32) => WasmI32 from "null0"

Create a new image of a gradient.

provide foreign wasm image_gradient: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Unload an image.

provide foreign wasm unload_image: (WasmI32) => Void from "null0"

Unload a font.

provide foreign wasm unload_font: (WasmI32) => Void from "null0"

Clear an image.

provide foreign wasm clear_image: (WasmI32, WasmI32) => Void from "null0"

Draw a single pixel on an image.

provide foreign wasm draw_point_on_image: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a line on an image.

provide foreign wasm draw_line_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled rectangle on an image.

provide foreign wasm draw_rectangle_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled triangle on an image.

provide foreign wasm draw_triangle_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled ellipse on an image.

provide foreign wasm draw_ellipse_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a circle on an image.

provide foreign wasm draw_circle_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled polygon on an image.

provide foreign wasm draw_polygon_on_image: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a filled round-rectangle on an image.

provide foreign wasm draw_rectangle_rounded_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw an image on an image.

provide foreign wasm draw_image_on_image: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a tinted image on an image.

provide foreign wasm draw_image_tint_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw an image, rotated, on an image.

provide foreign wasm draw_image_rotated_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmF32, WasmF32, WasmF32, WasmI32) => Void from "null0"

Draw an image, flipped, on an image.

provide foreign wasm draw_image_flipped_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw an image, scaled, on an image.

provide foreign wasm draw_image_scaled_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmF32, WasmF32, WasmF32, WasmF32, WasmI32) => Void from "null0"

Draw some text on an image.

provide foreign wasm draw_text_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) rectangle on the screen.

provide foreign wasm draw_rectangle_outline: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) triangle on the screen.

provide foreign wasm draw_triangle_outline: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) ellipse on the screen.

provide foreign wasm draw_ellipse_outline: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) circle on the screen.

provide foreign wasm draw_circle_outline: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) polygon on the screen.

provide foreign wasm draw_polygon_outline: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) arc on the screen.

provide foreign wasm draw_arc_outline: (WasmI32, WasmI32, WasmF32, WasmF32, WasmF32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) round-rectangle on the screen.

provide foreign wasm draw_rectangle_rounded_outline: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) rectangle on an image.

provide foreign wasm draw_rectangle_outline_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) triangle on an image.

provide foreign wasm draw_triangle_outline_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) ellipse on an image.

provide foreign wasm draw_ellipse_outline_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) circle on an image.

provide foreign wasm draw_circle_outline_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) polygon on an image.

provide foreign wasm draw_polygon_outline_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a outlined (with thickness) round-rectangle on an image.

provide foreign wasm draw_rectangle_rounded_outline_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"
gui (10)

Begin a GUI window. Returns false if the window is collapsed or closed - skip its contents, but still call gui_end_window.

provide foreign wasm gui_begin_window: (WasmI32, WasmI32) => WasmI32 from "null0"

End the current GUI window.

provide foreign wasm gui_end_window: () => Void from "null0"

A button. Returns true when it is clicked.

provide foreign wasm gui_button: (WasmI32) => WasmI32 from "null0"

A static text label.

provide foreign wasm gui_label: (WasmI32) => Void from "null0"

A block of wrapping text.

provide foreign wasm gui_text: (WasmI32) => Void from "null0"

A checkbox. Returns the (possibly changed) state.

provide foreign wasm gui_checkbox: (WasmI32, WasmI32) => WasmI32 from "null0"

A slider. Returns the (possibly changed) value.

provide foreign wasm gui_slider: (WasmF32, WasmF32, WasmF32) => WasmF32 from "null0"

Set the current layout row - the column widths (negative for flexible), and the row height.

provide foreign wasm gui_layout_row: (WasmI32, WasmI32, WasmI32) => Void from "null0"

Finish building the GUI for this frame. Called automatically at the end of update if you do not call it.

provide foreign wasm gui_end: () => Void from "null0"

Draw the GUI to an image (0 is the screen).

provide foreign wasm gui_draw: (WasmI32) => Void from "null0"
input (12)

Has the key been pressed? (tracks unpress/read correctly.)

provide foreign wasm key_pressed: (WasmI32) => WasmI32 from "null0"

Is the key currently down?

provide foreign wasm key_down: (WasmI32) => WasmI32 from "null0"

Has the key been released? (tracks press/read correctly.)

provide foreign wasm key_released: (WasmI32) => WasmI32 from "null0"

Is the key currently up?

provide foreign wasm key_up: (WasmI32) => WasmI32 from "null0"

Has the button been pressed? (tracks unpress/read correctly.)

provide foreign wasm gamepad_button_pressed: (WasmI32, WasmI32) => WasmI32 from "null0"

Is the button currently down?

provide foreign wasm gamepad_button_down: (WasmI32, WasmI32) => WasmI32 from "null0"

Has the button been released? (tracks press/read correctly.)

provide foreign wasm gamepad_button_released: (WasmI32, WasmI32) => WasmI32 from "null0"

Get current position of mouse.

provide foreign wasm mouse_position: () => WasmI32 from "null0"

Has the button been pressed? (tracks unpress/read correctly.)

provide foreign wasm mouse_button_pressed: (WasmI32) => WasmI32 from "null0"

Is the button currently down?

provide foreign wasm mouse_button_down: (WasmI32) => WasmI32 from "null0"

Has the button been released? (tracks press/read correctly.)

provide foreign wasm mouse_button_released: (WasmI32) => WasmI32 from "null0"

Is the button currently up?

provide foreign wasm mouse_button_up: (WasmI32) => WasmI32 from "null0"
sound (7)

Load a sound from a file in cart.

provide foreign wasm load_sound: (WasmI32) => WasmI32 from "null0"

Play a sound.

provide foreign wasm play_sound: (WasmI32, WasmI32) => Void from "null0"

Stop a sound.

provide foreign wasm stop_sound: (WasmI32) => Void from "null0"

Unload a sound.

provide foreign wasm unload_sound: (WasmI32) => Void from "null0"

Speak some text and return a sound. Set things to 0 for defaults.

provide foreign wasm tts_sound: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Create Sfx sound.

provide foreign wasm sfx_sound: (WasmI32) => WasmI32 from "null0"

Create Sfx parameters.

provide foreign wasm sfx_generate: (WasmI32) => WasmI32 from "null0"
tile (38)

Load a tilemap (a Tiled map, exported as JSON) from a file in cart.

provide foreign wasm load_tilemap: (WasmI32) => WasmI32 from "null0"

Unload a tilemap.

provide foreign wasm unload_tilemap: (WasmI32) => Void from "null0"

Update a tilemap's animation timers (deltaTime is in seconds).

provide foreign wasm tile_update: (WasmI32, WasmF32) => Void from "null0"

Get the size of a tilemap, in tiles.

provide foreign wasm tile_map_size: (WasmI32) => WasmI32 from "null0"

Get the size of a single tile of a tilemap, in pixels.

provide foreign wasm tile_tile_size: (WasmI32) => WasmI32 from "null0"

Get a custom property of a tilemap, by name (PROP_NONE when there is no such property.)

provide foreign wasm tile_map_prop: (WasmI32, WasmI32) => WasmI32 from "null0"

Get the number of custom properties on a tilemap.

provide foreign wasm tile_map_prop_count: (WasmI32) => WasmI32 from "null0"

Get a custom property of a tilemap, by index (PROP_NONE when out of range.)

provide foreign wasm tile_map_prop_at: (WasmI32, WasmI32) => WasmI32 from "null0"

Draw a tilemap on the screen.

provide foreign wasm tile_draw: (WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a tilemap on the screen, tinted by a color.

provide foreign wasm tile_draw_tint: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a tilemap on an image.

provide foreign wasm tile_draw_on_image: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Render a whole tilemap to a new image.

provide foreign wasm tilemap_image: (WasmI32) => WasmI32 from "null0"

Get the number of layers in a tilemap. Layers are numbered depth-first, so the children of a group layer have their own indexes too.

provide foreign wasm tile_layer_count: (WasmI32) => WasmI32 from "null0"

Get the index of a layer of a tilemap, by name (-1 when there is no such layer.)

provide foreign wasm tile_layer_index: (WasmI32, WasmI32) => WasmI32 from "null0"

Get the name of a layer of a tilemap.

provide foreign wasm tile_layer_name: (WasmI32, WasmI32) => WasmI32 from "null0"

Get the kind of a layer of a tilemap.

provide foreign wasm tile_layer_type: (WasmI32, WasmI32) => WasmI32 from "null0"

Get the size of a layer of a tilemap, in tiles.

provide foreign wasm tile_layer_size: (WasmI32, WasmI32) => WasmI32 from "null0"

Get whether a layer of a tilemap is visible. Drawing a layer that Tiled marked hidden draws nothing.

provide foreign wasm tile_layer_visible: (WasmI32, WasmI32) => WasmI32 from "null0"

Get a custom property of a layer of a tilemap, by name (PROP_NONE when there is no such property.)

provide foreign wasm tile_layer_prop: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Get the number of custom properties on a layer of a tilemap.

provide foreign wasm tile_layer_prop_count: (WasmI32, WasmI32) => WasmI32 from "null0"

Get a custom property of a layer of a tilemap, by index (PROP_NONE when out of range.)

provide foreign wasm tile_layer_prop_at: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Draw a single layer of a tilemap on the screen.

provide foreign wasm tile_draw_layer: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a single layer of a tilemap on the screen, tinted by a color.

provide foreign wasm tile_draw_layer_tint: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a single layer of a tilemap on an image.

provide foreign wasm tile_draw_layer_on_image: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Render a single layer of a tilemap to a new image.

provide foreign wasm tile_layer_image: (WasmI32, WasmI32) => WasmI32 from "null0"

Get the gid of the tile at a column/row in a tilemap layer.

provide foreign wasm tile_get_tile: (WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Set the gid of the tile at a column/row in a tilemap layer. Swapping a gid is how a cart keeps changing state in the map itself.

provide foreign wasm tile_set_tile: (WasmI32, WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Draw a single tile from a tilemap on the screen.

provide foreign wasm tile_draw_tile: (WasmI32, WasmI32, WasmI32, WasmI32) => Void from "null0"

Get a copy of the image of a single tile in a tilemap.

provide foreign wasm tile_image: (WasmI32, WasmI32) => WasmI32 from "null0"

Get a custom property of a tile of a tilemap, by name (PROP_NONE when there is no such property.) These come from the tileset, so every tile with this gid shares them.

provide foreign wasm tile_gid_prop: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Get the number of custom properties on a tile of a tilemap.

provide foreign wasm tile_gid_prop_count: (WasmI32, WasmI32) => WasmI32 from "null0"

Get a custom property of a tile of a tilemap, by index (PROP_NONE when out of range.)

provide foreign wasm tile_gid_prop_at: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Get the number of objects on an object-layer of a tilemap.

provide foreign wasm tile_object_count: (WasmI32, WasmI32) => WasmI32 from "null0"

Get an object from an object-layer of a tilemap.

provide foreign wasm tile_object: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Get the index of an object on an object-layer of a tilemap, by name (-1 when there is no such object.)

provide foreign wasm tile_object_index: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Get a custom property of an object of a tilemap, by name (PROP_NONE when there is no such property.)

provide foreign wasm tile_object_prop: (WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Get the number of custom properties on an object of a tilemap.

provide foreign wasm tile_object_prop_count: (WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"

Get a custom property of an object of a tilemap, by index (PROP_NONE when out of range.)

provide foreign wasm tile_object_prop_at: (WasmI32, WasmI32, WasmI32, WasmI32) => WasmI32 from "null0"
utilities (5)

Get system-time (ms) since unix epoch.

provide foreign wasm current_time: () => WasmI64 from "null0"

Get the change in time (seconds) since the last update run.

provide foreign wasm delta_time: () => WasmF32 from "null0"

Get a random integer between 2 numbers.

provide foreign wasm random_int: (WasmI32, WasmI32) => WasmI32 from "null0"

Get the random-seed.

provide foreign wasm random_seed_get: () => WasmI64 from "null0"

Set the random-seed.

provide foreign wasm random_seed_set: (WasmI64) => Void from "null0"