Skip to content

Rendering

Draw from Render, not Update. Keep game decisions in Update, then draw simple values in Render.

function Render()
    RenderTopRightText("Ready", 12, 12, 14, Color("#00FF00"), true)
end

Use Color and vector values from Lua values and game objects.

Screen helpers

Call Result
GetScreenSize() Screen Vector2. It can be { x = 0, y = 0 } when unavailable.
IsOnScreen(position) true when a screen position is inside the display.
GetZoom() Current camera zoom, or nil when no camera is available. A capture-only render pass returns 0.
GetCameraPosition() Camera Vector2, or nil when no camera is available. A capture-only render pass returns { x = 0, y = 0 }.

SetCameraPosition(position) requests native camera control immediately. It returns no value on success, or nil, "native camera control unavailable" when the native control cannot be used. This is a local view action, not a queued game command.

IsOnScreen expects a screen position. Use IsWorldPosOnScreen for a world position.

Screen primitives

Call Action
RenderText(text, position[, size[, color[, center[, border]]]]) Draw screen text.
RenderTopRightText(text[, marginX[, marginY[, size[, color[, border]]]]]) Draw text from the top-right.
RenderLine(from, to[, color[, thickness]]) Draw a screen line.
RenderCircle(center, radius[, color[, thickness[, segments]]]) Draw a screen circle.
RenderCircleFilled(center, radius[, color[, segments]]) Draw a filled screen circle.
RenderRect(min, max[, color[, rounding[, cornerFlags[, thickness]]]]) Draw a screen rectangle.
RenderRectFilled(min, max[, color[, rounding[, cornerFlags]]]) Draw a filled screen rectangle.

size uses the current font size by default. color defaults to opaque white. thickness defaults to 1. segments defaults to 32.

Set center to true to center RenderText. Set border to true to add a one-pixel black outline.

World projection

Call Result
IsWorldPosOnScreen(worldPosition) true when a world position is visible.
WorldToScreen(worldPosition) Screen Vector2, or nil when the view or projection is unavailable.
WorldToMinimap(worldPosition) Minimap Vector2, or nil.

Check IsWorldPosOnScreen before you use a projected position.

World primitives

Call Action
RenderWorldLine(from, to[, color[, thickness]]) Draw a projected world line.
RenderWorldRect(center, halfWidth, halfHeight[, color[, thickness]]) Draw a projected world rectangle.
RenderWorldRectFilled(center, halfWidth, halfHeight[, color]) Draw a filled world rectangle.
RenderWorldCircle(center, radius[, color[, thickness[, segments]]]) Draw a projected world circle.
RenderWorldCircleFilled(center, radius[, color[, segments]]) Draw a filled world circle.
RenderWorldText(text, position[, size[, color[, center[, border]]]]) Draw text at a world position.
RenderObjectBounds(object[, color[, thickness]]) Draw an object outline.
RenderObjectBoundsFilled(object[, color]) Draw a filled object outline.

World positions use { x, y, z }. A rectangle takes half-width and half-height. For example, halfWidth = 3 makes a six-unit total width.

World circles ignore a non-positive radius. Their segment count is limited to 8..192.

Minimap primitives

Call Action
RenderMinimapDot(worldPosition, radius[, color]) Draw a minimap dot.
RenderMinimapLine(from, to, thickness[, color]) Draw a minimap line.
RenderMinimapRect(center, halfWidth, halfHeight, color?, thickness) Draw a minimap rectangle.
RenderMinimapRectFilled(center, halfWidth, halfHeight[, color]) Draw a filled minimap rectangle.

RenderMinimapLine takes thickness before color. RenderMinimapRect requires thickness.

The map or drawing view can be unavailable during a state change. Draw calls then produce no output. Check positions and keep Render free of game logic.