This is generated from the engine's API definition, for null0 0.0.22. Pick a language to see every signature in that language's own spelling.
Showing pseudo-code. Structs are passed by pointer under the hood, but every high-level binding hides that for you.
types
These are the types of parameters, or things a function can return.
void- This function does not return anything.i32- Signed integer, 32 bits (4 bytes.)u32- Unsigned integer, 32 bits (4 bytes.)u64- Unsigned integer, 64 bits (8 bytes.)f32- Floating-point decimal, 32 bits (4 bytes.)bool- Boolean (true/false.)Image- An image. 0 is "the screen".Font- A font. 0 is "the default font".Sound- A sound.Tilemap- A tilemap (a Tiled map, exported as JSON). 0 is an invalid tilemap.string- Pointer to a null-terminated UTF8 string. (char*)Vector[]- An array of Vectors.i32[]- An array of i32.
structs
A compound object, used to pass several values at once.
SfxParams
Sfx parameters.
u32 randSeed
i32 waveType
f32 attackTime
f32 sustainTime
f32 sustainPunch
f32 decayTime
f32 startFrequency
f32 minFrequency
f32 slide
f32 deltaSlide
f32 vibratoDepth
f32 vibratoSpeed
f32 changeAmount
f32 changeSpeed
f32 squareDuty
f32 dutySweep
f32 repeatSpeed
f32 phaserOffset
f32 phaserSweep
f32 lpfCutoff
f32 lpfCutoffSweep
f32 lpfResonance
f32 hpfCutoff
f32 hpfCutoffSweepDimensions
The 2D size of something (width/height.)
i32 width
i32 heightVector
The 2D position of something (x/y.)
i32 x
i32 yRectangle
The 2D position + size of something (x/y/w/h.)
i32 x
i32 y
i32 width
i32 heightColor
An RGBA color.
u8 r
u8 g
u8 b
u8 aTilemapProp
A custom property on a tilemap, layer, object, or tile. Only the member named by `type` is meaningful - a PROP_BOOL is 0/1 in `integer`, and a PROP_COLOR is RGBA bytes in `integer`.
string name
TilePropType type
i32 integer
f32 number
string textTilemapObject
An object from an object-layer of a tilemap. This is the map's initial state - carts own whatever they spawn from it.
i32 id
string name
string type
i32 gid
f32 x
f32 y
f32 width
f32 height
f32 rotation
i32 visibleenums
A named set of values for an integer field. Every one of these is available as a plain constant in your cart.
ImageFilter - Potential image-filtering techniques for scale/etc.
FILTER_NEARESTNEIGHBOR = 0
FILTER_BILINEAR = 1
FILTER_SMOOTH = 2SfxPresetType - Represents a Sfx preset type.
SFX_COIN = 0
SFX_LASER = 1
SFX_EXPLOSION = 2
SFX_POWERUP = 3
SFX_HURT = 4
SFX_JUMP = 5
SFX_SELECT = 6
SFX_SYNTH = 7Key - Represents a keyboard key.
KEY_INVALID = 0
KEY_SPACE = 32
KEY_APOSTROPHE = 39
KEY_COMMA = 44
KEY_MINUS = 45
KEY_PERIOD = 46
KEY_SLASH = 47
KEY_0 = 48
KEY_1 = 49
KEY_2 = 50
KEY_3 = 51
KEY_4 = 52
KEY_5 = 53
KEY_6 = 54
KEY_7 = 55
KEY_8 = 56
KEY_9 = 57
KEY_SEMICOLON = 59
KEY_EQUAL = 61
KEY_A = 65
KEY_B = 66
KEY_C = 67
KEY_D = 68
KEY_E = 69
KEY_F = 70
KEY_G = 71
KEY_H = 72
KEY_I = 73
KEY_J = 74
KEY_K = 75
KEY_L = 76
KEY_M = 77
KEY_N = 78
KEY_O = 79
KEY_P = 80
KEY_Q = 81
KEY_R = 82
KEY_S = 83
KEY_T = 84
KEY_U = 85
KEY_V = 86
KEY_W = 87
KEY_X = 88
KEY_Y = 89
KEY_Z = 90
KEY_LEFT_BRACKET = 91
KEY_BACKSLASH = 92
KEY_RIGHT_BRACKET = 93
KEY_GRAVE_ACCENT = 96
KEY_WORLD_1 = 161
KEY_WORLD_2 = 162
KEY_ESCAPE = 256
KEY_ENTER = 257
KEY_TAB = 258
KEY_BACKSPACE = 259
KEY_INSERT = 260
KEY_DELETE = 261
KEY_RIGHT = 262
KEY_LEFT = 263
KEY_DOWN = 264
KEY_UP = 265
KEY_PAGE_UP = 266
KEY_PAGE_DOWN = 267
KEY_HOME = 268
KEY_END = 269
KEY_CAPS_LOCK = 280
KEY_SCROLL_LOCK = 281
KEY_NUM_LOCK = 282
KEY_PRINT_SCREEN = 283
KEY_PAUSE = 284
KEY_F1 = 290
KEY_F2 = 291
KEY_F3 = 292
KEY_F4 = 293
KEY_F5 = 294
KEY_F6 = 295
KEY_F7 = 296
KEY_F8 = 297
KEY_F9 = 298
KEY_F10 = 299
KEY_F11 = 300
KEY_F12 = 301
KEY_F13 = 302
KEY_F14 = 303
KEY_F15 = 304
KEY_F16 = 305
KEY_F17 = 306
KEY_F18 = 307
KEY_F19 = 308
KEY_F20 = 309
KEY_F21 = 310
KEY_F22 = 311
KEY_F23 = 312
KEY_F24 = 313
KEY_F25 = 314
KEY_KP_0 = 320
KEY_KP_1 = 321
KEY_KP_2 = 322
KEY_KP_3 = 323
KEY_KP_4 = 324
KEY_KP_5 = 325
KEY_KP_6 = 326
KEY_KP_7 = 327
KEY_KP_8 = 328
KEY_KP_9 = 329
KEY_KP_DECIMAL = 330
KEY_KP_DIVIDE = 331
KEY_KP_MULTIPLY = 332
KEY_KP_SUBTRACT = 333
KEY_KP_ADD = 334
KEY_KP_ENTER = 335
KEY_KP_EQUAL = 336
KEY_LEFT_SHIFT = 340
KEY_LEFT_CONTROL = 341
KEY_LEFT_ALT = 342
KEY_LEFT_SUPER = 343
KEY_RIGHT_SHIFT = 344
KEY_RIGHT_CONTROL = 345
KEY_RIGHT_ALT = 346
KEY_RIGHT_SUPER = 347
KEY_MENU = 348GamepadButton - Represents a gamepad button.
GAMEPAD_BUTTON_UNKNOWN = 0
GAMEPAD_BUTTON_UP = 1
GAMEPAD_BUTTON_RIGHT = 2
GAMEPAD_BUTTON_DOWN = 3
GAMEPAD_BUTTON_LEFT = 4
GAMEPAD_BUTTON_Y = 5
GAMEPAD_BUTTON_B = 6
GAMEPAD_BUTTON_A = 7
GAMEPAD_BUTTON_X = 8
GAMEPAD_BUTTON_LEFT_SHOULDER = 9
GAMEPAD_BUTTON_LEFT_TRIGGER = 10
GAMEPAD_BUTTON_RIGHT_SHOULDER = 11
GAMEPAD_BUTTON_RIGHT_TRIGGER = 12
GAMEPAD_BUTTON_SELECT = 13
GAMEPAD_BUTTON_MENU = 14
GAMEPAD_BUTTON_START = 15
GAMEPAD_BUTTON_LEFT_THUMB = 16
GAMEPAD_BUTTON_RIGHT_THUMB = 17MouseButton - Represents a mouse button.
MOUSE_BUTTON_UNKNOWN = 0
MOUSE_BUTTON_LEFT = 1
MOUSE_BUTTON_RIGHT = 2
MOUSE_BUTTON_MIDDLE = 3TileLayerKind - The kind of a layer in a tilemap.
LAYER_NONE = 0
LAYER_TILE = 1
LAYER_OBJECT = 2
LAYER_IMAGE = 3
LAYER_GROUP = 4TilePropType - The type of a tilemap property's value. Tiled's "file" properties arrive as PROP_STRING.
PROP_NONE = 0
PROP_INT = 1
PROP_BOOL = 2
PROP_FLOAT = 3
PROP_STRING = 4
PROP_COLOR = 5colors
Pre-defined in every cart language:
LIGHTGRAYGRAYDARKGRAYYELLOWGOLDORANGEPINKREDMAROONGREENLIMEDARKGREENSKYBLUEBLUEDARKBLUEPURPLEVIOLETDARKPURPLEBEIGEBROWNDARKBROWNWHITEBLACKBLANKMAGENTARAYWHITEconstants
FONT_DEFAULT=0- The default fonts's number is 0SCREEN=0- The screen's image number is 0SCREEN_WIDTH=640- the width of the screen (in pixels)SCREEN_HEIGHT=480- the height of the screen (in pixels)NULL0_VERSION=0.0.22- The current tagged version of null0 engine
callbacks
Callbacks are how you define your game - implement the ones you need and the host skips the rest. See anatomy of a cart.
keyUp
Called when keys are unpressed.
void keyUp(Key key)keyDown
Called when keys are pressed.
void keyDown(Key key)mouseDown
Called when mouse-button is pressed.
void mouseDown(MouseButton button)mouseUp
Called when mouse-button is released.
void mouseUp(MouseButton button)mouseMoved
Called when mouse is moved.
void mouseMoved(f32 x, f32 y)api
These are the things you can do in your game.
colors
color_tint
Tint a color with another color.
Color color_tint(Color color, Color tint)color_fade
Fade a color.
Color color_fade(Color color, f32 alpha)color_brightness
Change the brightness of a color.
Color color_brightness(Color color, f32 factor)color_invert
Invert a color.
Color color_invert(Color color)color_alpha_blend
Blend 2 colors together.
Color color_alpha_blend(Color dst, Color src)color_contrast
Change contrast of a color.
Color color_contrast(Color color, f32 contrast)color_bilinear_interpolate
Interpolate colors.
Color color_bilinear_interpolate(Color color00, Color color01, Color color10, Color color11, f32 coordinateX, f32 coordinateY)graphics
new_image
Create a new blank image.
Image new_image(i32 width, i32 height, Color color)image_copy
Copy an image to a new image.
Image image_copy(Image image)image_subimage
Create an image from a region of another image.
Image image_subimage(Image image, i32 x, i32 y, i32 width, i32 height)clear
Clear the screen.
void clear(Color color)draw_point
Draw a single pixel on the screen.
void draw_point(i32 x, i32 y, Color color)draw_line
Draw a line on the screen.
void draw_line(i32 startPosX, i32 startPosY, i32 endPosX, i32 endPosY, Color color)draw_rectangle
Draw a filled rectangle on the screen.
void draw_rectangle(i32 posX, i32 posY, i32 width, i32 height, Color color)draw_triangle
Draw a filled triangle on the screen.
void draw_triangle(i32 x1, i32 y1, i32 x2, i32 y2, i32 x3, i32 y3, Color color)draw_ellipse
Draw a filled ellipse on the screen.
void draw_ellipse(i32 centerX, i32 centerY, i32 radiusX, i32 radiusY, Color color)draw_circle
Draw a filled circle on the screen.
void draw_circle(i32 centerX, i32 centerY, i32 radius, Color color)draw_polygon
Draw a filled polygon on the screen.
void draw_polygon(Vector[] points, i32 numPoints, Color color)draw_arc
Draw a filled arc on the screen.
void draw_arc(i32 centerX, i32 centerY, f32 radius, f32 startAngle, f32 endAngle, i32 segments, Color color)draw_rectangle_rounded
Draw a filled round-rectangle on the screen.
void draw_rectangle_rounded(i32 x, i32 y, i32 width, i32 height, i32 cornerRadius, Color color)draw_image
Draw an image on the screen.
void draw_image(Image src, i32 posX, i32 posY)draw_image_tint
Draw a tinted image on the screen.
void draw_image_tint(Image src, i32 posX, i32 posY, Color tint)draw_image_rotated
Draw an image, rotated, on the screen.
void draw_image_rotated(Image src, i32 posX, i32 posY, f32 degrees, f32 offsetX, f32 offsetY, ImageFilter filter)draw_image_flipped
Draw an image, flipped, on the screen.
void draw_image_flipped(Image src, i32 posX, i32 posY, bool flipHorizontal, bool flipVertical, bool flipDiagonal)draw_image_scaled
Draw an image, scaled, on the screen.
void draw_image_scaled(Image src, i32 posX, i32 posY, f32 scaleX, f32 scaleY, f32 offsetX, f32 offsetY, ImageFilter filter)draw_text
Draw some text on the screen.
void draw_text(Font font, string text, i32 posX, i32 posY, Color color)save_image
Save an image to persistant storage.
void save_image(Image image, string filename)load_image
Load an image from a file in cart.
Image load_image(string filename)image_resize
Resize an image, return copy.
Image image_resize(Image image, i32 newWidth, i32 newHeight, ImageFilter filter)image_scale
Scale an image, return copy.
Image image_scale(Image image, f32 scaleX, f32 scaleY, ImageFilter filter)image_color_replace
Replace a color in an image, in-place.
void image_color_replace(Image image, Color color, Color replace)image_color_tint
Tint a color in an image, in-place.
void image_color_tint(Image image, Color color)image_color_fade
Fade a color in an image, in-place.
void image_color_fade(Image image, f32 alpha)font_copy
Copy a font to a new font.
Font font_copy(Font font)font_scale
Scale a font, return a new font.
Font font_scale(Font font, f32 scaleX, f32 scaleY, ImageFilter filter)load_font_bmf
Load a BMF font from a file in cart.
Font load_font_bmf(string filename, string characters)load_font_bmf_from_image
Load a BMF font from an image.
Font load_font_bmf_from_image(Image image, string characters)measure_text
Measure the size of some text.
Dimensions measure_text(Font font, string text, i32 textLength)measure_image
Meaure an image (use 0 for screen).
Dimensions measure_image(Image image)load_font_tty
Load a TTY font from a file in cart.
Font load_font_tty(string filename, i32 glyphWidth, i32 glyphHeight, string characters)load_font_tty_from_image
Load a TTY font from an image.
Font load_font_tty_from_image(Image image, i32 glyphWidth, i32 glyphHeight, string characters)load_font_ttf
Load a TTF font from a file in cart.
Font load_font_ttf(string filename, i32 fontSize)image_color_invert
Invert the colors in an image, in-place.
void image_color_invert(Image image)image_alpha_border
Calculate a rectangle representing the available alpha border in an image.
Rectangle image_alpha_border(Image image, f32 threshold)image_crop
Crop an image, in-place.
void image_crop(Image image, i32 x, i32 y, i32 width, i32 height)image_alpha_crop
Crop an image based on the alpha border, in-place.
void image_alpha_crop(Image image, f32 threshold)image_color_brightness
Adjust the brightness of an image, in-place.
void image_color_brightness(Image image, f32 factor)image_flip
Flip an image, in-place.
void image_flip(Image image, bool horizontal, bool vertical)image_color_contrast
Change the contrast of an image, in-place.
void image_color_contrast(Image image, f32 contrast)image_alpha_mask
Use an image as an alpha-mask on another image.
void image_alpha_mask(Image image, Image alphaMask, i32 posX, i32 posY)image_rotate
Create a new image, rotating another image.
Image image_rotate(Image image, f32 degrees, ImageFilter filter)image_gradient
Create a new image of a gradient.
Image image_gradient(i32 width, i32 height, Color topLeft, Color topRight, Color bottomLeft, Color bottomRight)unload_image
Unload an image.
void unload_image(Image image)unload_font
Unload a font.
void unload_font(Font font)clear_image
Clear an image.
void clear_image(Image destination, Color color)draw_point_on_image
Draw a single pixel on an image.
void draw_point_on_image(Image destination, i32 x, i32 y, Color color)draw_line_on_image
Draw a line on an image.
void draw_line_on_image(Image destination, i32 startPosX, i32 startPosY, i32 endPosX, i32 endPosY, Color color)draw_rectangle_on_image
Draw a filled rectangle on an image.
void draw_rectangle_on_image(Image destination, i32 posX, i32 posY, i32 width, i32 height, Color color)draw_triangle_on_image
Draw a filled triangle on an image.
void draw_triangle_on_image(Image destination, i32 x1, i32 y1, i32 x2, i32 y2, i32 x3, i32 y3, Color color)draw_ellipse_on_image
Draw a filled ellipse on an image.
void draw_ellipse_on_image(Image destination, i32 centerX, i32 centerY, i32 radiusX, i32 radiusY, Color color)draw_circle_on_image
Draw a circle on an image.
void draw_circle_on_image(Image destination, i32 centerX, i32 centerY, i32 radius, Color color)draw_polygon_on_image
Draw a filled polygon on an image.
void draw_polygon_on_image(Image destination, Vector[] points, i32 numPoints, Color color)draw_rectangle_rounded_on_image
Draw a filled round-rectangle on an image.
void draw_rectangle_rounded_on_image(Image destination, i32 x, i32 y, i32 width, i32 height, i32 cornerRadius, Color color)draw_image_on_image
Draw an image on an image.
void draw_image_on_image(Image destination, Image src, i32 posX, i32 posY)draw_image_tint_on_image
Draw a tinted image on an image.
void draw_image_tint_on_image(Image destination, Image src, i32 posX, i32 posY, Color tint)draw_image_rotated_on_image
Draw an image, rotated, on an image.
void draw_image_rotated_on_image(Image destination, Image src, i32 posX, i32 posY, f32 degrees, f32 offsetX, f32 offsetY, ImageFilter filter)draw_image_flipped_on_image
Draw an image, flipped, on an image.
void draw_image_flipped_on_image(Image destination, Image src, i32 posX, i32 posY, bool flipHorizontal, bool flipVertical, bool flipDiagonal)draw_image_scaled_on_image
Draw an image, scaled, on an image.
void draw_image_scaled_on_image(Image destination, Image src, i32 posX, i32 posY, f32 scaleX, f32 scaleY, f32 offsetX, f32 offsetY, ImageFilter filter)draw_text_on_image
Draw some text on an image.
void draw_text_on_image(Image destination, Font font, string text, i32 posX, i32 posY, Color color)draw_rectangle_outline
Draw a outlined (with thickness) rectangle on the screen.
void draw_rectangle_outline(i32 posX, i32 posY, i32 width, i32 height, i32 thickness, Color color)draw_triangle_outline
Draw a outlined (with thickness) triangle on the screen.
void draw_triangle_outline(i32 x1, i32 y1, i32 x2, i32 y2, i32 x3, i32 y3, i32 thickness, Color color)draw_ellipse_outline
Draw a outlined (with thickness) ellipse on the screen.
void draw_ellipse_outline(i32 centerX, i32 centerY, i32 radiusX, i32 radiusY, i32 thickness, Color color)draw_circle_outline
Draw a outlined (with thickness) circle on the screen.
void draw_circle_outline(i32 centerX, i32 centerY, i32 radius, i32 thickness, Color color)draw_polygon_outline
Draw a outlined (with thickness) polygon on the screen.
void draw_polygon_outline(Vector[] points, i32 numPoints, i32 thickness, Color color)draw_arc_outline
Draw a outlined (with thickness) arc on the screen.
void draw_arc_outline(i32 centerX, i32 centerY, f32 radius, f32 startAngle, f32 endAngle, i32 segments, i32 thickness, Color color)draw_rectangle_rounded_outline
Draw a outlined (with thickness) round-rectangle on the screen.
void draw_rectangle_rounded_outline(i32 x, i32 y, i32 width, i32 height, i32 cornerRadius, i32 thickness, Color color)draw_rectangle_outline_on_image
Draw a outlined (with thickness) rectangle on an image.
void draw_rectangle_outline_on_image(Image destination, i32 posX, i32 posY, i32 width, i32 height, i32 thickness, Color color)draw_triangle_outline_on_image
Draw a outlined (with thickness) triangle on an image.
void draw_triangle_outline_on_image(Image destination, i32 x1, i32 y1, i32 x2, i32 y2, i32 x3, i32 y3, i32 thickness, Color color)draw_ellipse_outline_on_image
Draw a outlined (with thickness) ellipse on an image.
void draw_ellipse_outline_on_image(Image destination, i32 centerX, i32 centerY, i32 radiusX, i32 radiusY, i32 thickness, Color color)draw_circle_outline_on_image
Draw a outlined (with thickness) circle on an image.
void draw_circle_outline_on_image(Image destination, i32 centerX, i32 centerY, i32 radius, i32 thickness, Color color)draw_polygon_outline_on_image
Draw a outlined (with thickness) polygon on an image.
void draw_polygon_outline_on_image(Image destination, Vector[] points, i32 numPoints, i32 thickness, Color color)draw_rectangle_rounded_outline_on_image
Draw a outlined (with thickness) round-rectangle on an image.
void draw_rectangle_rounded_outline_on_image(Image destination, i32 x, i32 y, i32 width, i32 height, i32 cornerRadius, i32 thickness, Color color)gui
gui_begin_window
Begin a GUI window. Returns false if the window is collapsed or closed - skip its contents, but still call gui_end_window.
bool gui_begin_window(string title, Rectangle rect)gui_end_window
End the current GUI window.
void gui_end_window()gui_label
A static text label.
void gui_label(string text)gui_text
A block of wrapping text.
void gui_text(string text)gui_checkbox
A checkbox. Returns the (possibly changed) state.
bool gui_checkbox(string label, bool state)gui_slider
A slider. Returns the (possibly changed) value.
f32 gui_slider(f32 value, f32 low, f32 high)gui_layout_row
Set the current layout row - the column widths (negative for flexible), and the row height.
void gui_layout_row(i32[] widths, i32 numWidths, i32 height)gui_end
Finish building the GUI for this frame. Called automatically at the end of update if you do not call it.
void gui_end()gui_draw
Draw the GUI to an image (0 is the screen).
void gui_draw(Image dst)input
key_pressed
Has the key been pressed? (tracks unpress/read correctly.)
bool key_pressed(Key key)key_down
Is the key currently down?
bool key_down(Key key)key_released
Has the key been released? (tracks press/read correctly.)
bool key_released(Key key)key_up
Is the key currently up?
bool key_up(Key key)mouse_position
Get current position of mouse.
Vector mouse_position()sound
load_sound
Load a sound from a file in cart.
Sound load_sound(string filename)play_sound
Play a sound.
void play_sound(Sound sound, bool loop)stop_sound
Stop a sound.
void stop_sound(Sound sound)unload_sound
Unload a sound.
void unload_sound(Sound sound)tts_sound
Speak some text and return a sound. Set things to 0 for defaults.
Sound tts_sound(string text, bool phonetic, i32 pitch, i32 speed, i32 throat, i32 mouth, bool sing)sfx_sound
Create Sfx sound.
Sound sfx_sound(SfxParams params)sfx_generate
Create Sfx parameters.
SfxParams sfx_generate(SfxPresetType type)tile
load_tilemap
Load a tilemap (a Tiled map, exported as JSON) from a file in cart.
Tilemap load_tilemap(string filename)unload_tilemap
Unload a tilemap.
void unload_tilemap(Tilemap tilemap)tile_update
Update a tilemap's animation timers (deltaTime is in seconds).
void tile_update(Tilemap tilemap, f32 deltaTime)tile_map_size
Get the size of a tilemap, in tiles.
Dimensions tile_map_size(Tilemap tilemap)tile_tile_size
Get the size of a single tile of a tilemap, in pixels.
Dimensions tile_tile_size(Tilemap tilemap)tile_map_prop
Get a custom property of a tilemap, by name (PROP_NONE when there is no such property.)
TilemapProp tile_map_prop(Tilemap tilemap, string name)tile_map_prop_count
Get the number of custom properties on a tilemap.
i32 tile_map_prop_count(Tilemap tilemap)tile_map_prop_at
Get a custom property of a tilemap, by index (PROP_NONE when out of range.)
TilemapProp tile_map_prop_at(Tilemap tilemap, i32 index)tile_draw
Draw a tilemap on the screen.
void tile_draw(Tilemap tilemap, i32 posX, i32 posY)tile_draw_tint
Draw a tilemap on the screen, tinted by a color.
void tile_draw_tint(Tilemap tilemap, i32 posX, i32 posY, Color tint)tile_draw_on_image
Draw a tilemap on an image.
void tile_draw_on_image(Image dst, Tilemap tilemap, i32 posX, i32 posY)tilemap_image
Render a whole tilemap to a new image.
Image tilemap_image(Tilemap tilemap)tile_layer_count
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.
i32 tile_layer_count(Tilemap tilemap)tile_layer_index
Get the index of a layer of a tilemap, by name (-1 when there is no such layer.)
i32 tile_layer_index(Tilemap tilemap, string name)tile_layer_name
Get the name of a layer of a tilemap.
string tile_layer_name(Tilemap tilemap, i32 layer)tile_layer_type
Get the kind of a layer of a tilemap.
TileLayerKind tile_layer_type(Tilemap tilemap, i32 layer)tile_layer_size
Get the size of a layer of a tilemap, in tiles.
Dimensions tile_layer_size(Tilemap tilemap, i32 layer)tile_layer_visible
Get whether a layer of a tilemap is visible. Drawing a layer that Tiled marked hidden draws nothing.
bool tile_layer_visible(Tilemap tilemap, i32 layer)tile_layer_prop
Get a custom property of a layer of a tilemap, by name (PROP_NONE when there is no such property.)
TilemapProp tile_layer_prop(Tilemap tilemap, i32 layer, string name)tile_layer_prop_count
Get the number of custom properties on a layer of a tilemap.
i32 tile_layer_prop_count(Tilemap tilemap, i32 layer)tile_layer_prop_at
Get a custom property of a layer of a tilemap, by index (PROP_NONE when out of range.)
TilemapProp tile_layer_prop_at(Tilemap tilemap, i32 layer, i32 index)tile_draw_layer
Draw a single layer of a tilemap on the screen.
void tile_draw_layer(Tilemap tilemap, i32 layer, i32 posX, i32 posY)tile_draw_layer_tint
Draw a single layer of a tilemap on the screen, tinted by a color.
void tile_draw_layer_tint(Tilemap tilemap, i32 layer, i32 posX, i32 posY, Color tint)tile_draw_layer_on_image
Draw a single layer of a tilemap on an image.
void tile_draw_layer_on_image(Image dst, Tilemap tilemap, i32 layer, i32 posX, i32 posY)tile_layer_image
Render a single layer of a tilemap to a new image.
Image tile_layer_image(Tilemap tilemap, i32 layer)tile_get_tile
Get the gid of the tile at a column/row in a tilemap layer.
i32 tile_get_tile(Tilemap tilemap, i32 layer, i32 column, i32 row)tile_set_tile
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.
void tile_set_tile(Tilemap tilemap, i32 layer, i32 column, i32 row, i32 gid)tile_draw_tile
Draw a single tile from a tilemap on the screen.
void tile_draw_tile(Tilemap tilemap, i32 gid, i32 posX, i32 posY)tile_image
Get a copy of the image of a single tile in a tilemap.
Image tile_image(Tilemap tilemap, i32 gid)tile_gid_prop
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.
TilemapProp tile_gid_prop(Tilemap tilemap, i32 gid, string name)tile_gid_prop_count
Get the number of custom properties on a tile of a tilemap.
i32 tile_gid_prop_count(Tilemap tilemap, i32 gid)tile_gid_prop_at
Get a custom property of a tile of a tilemap, by index (PROP_NONE when out of range.)
TilemapProp tile_gid_prop_at(Tilemap tilemap, i32 gid, i32 index)tile_object_count
Get the number of objects on an object-layer of a tilemap.
i32 tile_object_count(Tilemap tilemap, i32 layer)tile_object
Get an object from an object-layer of a tilemap.
TilemapObject tile_object(Tilemap tilemap, i32 layer, i32 index)tile_object_index
Get the index of an object on an object-layer of a tilemap, by name (-1 when there is no such object.)
i32 tile_object_index(Tilemap tilemap, i32 layer, string name)tile_object_prop
Get a custom property of an object of a tilemap, by name (PROP_NONE when there is no such property.)
TilemapProp tile_object_prop(Tilemap tilemap, i32 layer, i32 index, string name)tile_object_prop_count
Get the number of custom properties on an object of a tilemap.
i32 tile_object_prop_count(Tilemap tilemap, i32 layer, i32 index)tile_object_prop_at
Get a custom property of an object of a tilemap, by index (PROP_NONE when out of range.)
TilemapProp tile_object_prop_at(Tilemap tilemap, i32 layer, i32 index, i32 propIndex)utilities
current_time
Get system-time (ms) since unix epoch.
u64 current_time()delta_time
Get the change in time (seconds) since the last update run.
f32 delta_time()random_int
Get a random integer between 2 numbers.
i32 random_int(i32 min, i32 max)random_seed_get
Get the random-seed.
u64 random_seed_get()random_seed_set
Set the random-seed.
void random_seed_set(u64 seed)