Skip to content

renderer

Immediate-mode drawing over the game’s frame. Call these only inside the paint event. Colours are 0-255; coordinates are overlay pixels. Each returns whether it drew.

renderer.text(x: number, y: number, r: integer, g: integer, b: integer, a: integer, flags: string, max_width: number, ...): boolean

Argument Type Description
x, y number Top-left, overlay pixels.
r, g, b, a integer Colour.
flags string + large, - small, c centred, r right-aligned, b bold. nil for default.
max_width number Wrap width; 0 does not wrap.
Concatenated into the string.

Draws text.

renderer.measure_text(flags: string, ...): number, number

Argument Type Description
flags string Same flags as renderer.text.
The string.

Measures text without drawing it. Returns width, height.

renderer.rectangle(x: number, y: number, w: number, h: number, r: integer, g: integer, b: integer, a: integer): boolean

A filled rectangle at x, y sized w, h.

renderer.gradient(x, y, w, h, r1, g1, b1, a1, r2, g2, b2, a2, ltr: boolean): boolean

Argument Type Description
r1..a1 integer First colour.
r2..a2 integer Second colour.
ltr boolean true fills left-to-right, else top-to-bottom.

A two-colour gradient rectangle.

renderer.line(xa: number, ya: number, xb: number, yb: number, r: integer, g: integer, b: integer, a: integer): boolean

A line from (xa, ya) to (xb, yb).

renderer.circle(x, y, r, g, b, a, radius: number[, start_degrees, percentage]): boolean

Argument Type Description
radius number Circle radius.
start_degrees number Arc start; omit for a full disc.
percentage number Arc sweep, 0-1.

A filled circle, or an arc when start_degrees/percentage are given.

renderer.circle_outline(x, y, r, g, b, a, radius[, start_degrees, percentage, thickness]): boolean

A circle or arc outline of thickness.

renderer.triangle(x0, y0, x1, y1, x2, y2, r, g, b, a): boolean

A filled triangle through the three points.

renderer.polyline(points: vec2[], r: integer, g: integer, b: integer, a: integer[, thickness: number]): boolean

Argument Type Description
points vec2[] { {x=, y=}, ... }.
thickness number Line width.

A connected path through points. A Lynx extra, for drawing custom prediction paths.

renderer.texture(id: integer, x, y, w, h, r, g, b, a[, mode: string]): boolean

Argument Type Description
id integer A texture id from a load_* call.
mode string Fit mode.

Draws a loaded texture into x, y, w, h, tinted by the colour.

renderer.image(id: integer, x, y, w, h, r, g, b, a[, mode: string]): boolean

Alias of renderer.texture. Draws a loaded texture or an icon id into x, y, w, h, tinted by the colour.

renderer.icon(name: string): integer

Resolve a built-in Font Awesome icon by name to a texture id, e.g. renderer.icon("crosshairs"). Draw the returned id with renderer.image / renderer.texture. No upload; the icon atlas ships with the overlay.

renderer.load_png(contents: string): integer

Uploads a PNG and returns a texture id.

renderer.load_jpg(contents: string): integer

Uploads a JPEG and returns a texture id.

renderer.load_svg(contents: string): integer

Uploads arbitrary SVG source and returns a texture id. Returns nil when the bytes are not SVG.

renderer.load_rgba(contents: string, width: integer, height: integer): integer

Uploads raw RGBA pixels and returns a texture id.

renderer.indicator(r: integer, g: integer, b: integer, a: integer, ...): number|nil

A stacked top-left indicator line. Returns its y, or nil when the frame’s draw budget is full.

renderer.world_to_screen(x: number, y: number[, z: number]): number|nil, number|nil

Argument Type Description
x, y, z number A game point. On the table games the input is table coordinates.

Projects a game point to overlay pixels. Returns nil when off-screen or the transform is unavailable.