Skip to content

overlay

Description

Function for drawing and interacting with rendered visuals.


circle_outline

gradient

overlay.gradient(x, y, w, h, r1, g1, b1, a1, r2, g2, b2, a2, direction)

Draws a horizontal or vertical gradient on the screen.

line

overlay.line(x1, y1, x2, y2, r, g, b, a)

Draws a line on the screen.

load_img

overlay.load_img(contents, width, height)

Loads a texture (or an array of textures) from raw image contents (with file header). Supports PNG, JPG, GIF, APNG. Returns a texture ID that can be used with texture, or nil on failure.

load_rgba

overlay.load_rgba(contents, width, height)

Loads a texture from a RGBA buffer. Returns a texture ID that can be used with texture, or nil on failure.

load_svg

overlay.load_svg(contents, width, height)

Loads an SVG from a string. Returns a texture ID that can be used with texture, or nil on failure.

measure_text

overlay.measure_text(string, flags)

Returns width and height of text.

rectangle

overlay.rectangle(x, y, w, h, r, g, b, a)

Draws a filled rectangle on the screen.

texture

overlay.texture(texture, x, y, w, h, r, g, b, a, mode: optional)

Draws a texture from the texture id created from load_rgba or load_img.

triangle

overlay.triangle(x1, y1, x2, y2, x3, y3, r, g, b, a)

Draws a filled triangle on the screen. The points need to be specified in clockwise order.

wts

overlay.wts(x, y, z)

Returns the screen coordinates of a world position or nil if the world position is not visible on the screen.