Skip to main content
Immediate-mode 2D drawing on the overlay, in screen pixels with the origin at the top-left.
Draw calls only work inside an on("render") listener. Anywhere else (a tick, a timer, after an await) they throw. Queries (measureText, worldToScreen, screenTransform, boundsOf, screenSize) work anywhere.

Overview

Shapes

line, rect, circle, arc, triangle, polyline, curves and their filled versions.

Text and images

text, measureText, image, imageQuad, your own fonts.

Effects

Gradients, soft shadows and glows, frosted-glass blur.

Groups

push / pop: clip, fade, move, rotate, scale, draw above the menu.

World space

line3d, polyline3d, circle3d.

Screen and projection

screenSize, worldToScreen, screenTransform, boundsOf.
Positions are Vec2Like: [x, y], { x, y } or a Vector2. Colors are ColorLike and always required: "#ff4040", [255, 64, 64, 200], a Color or a packed 0xAABBGGRR. The last argument is an optional options object.

Shapes

Every shape except rectGradient also takes a gradient. Arc angles are radians: 0 points right and they grow clockwise. polyline needs at least 2 points, polygonFilled at least 3. polygonFilled takes any shape, convex or not, as long as the outline doesn’t cross itself.

Text and images

text


Draws text at position, top-left corner by default. Non-strings go through String(), and \n starts a new line.

measureText


The size render.text covers with the same size, font, wrap and letterSpacing. For plain centering, align on render.text is simpler.

image


Stretches a Texture over min–max. Draws nothing until the texture is ready.
Need pixels that change every frame (a graph, a visualizer)? Make one texture with Texture.fromMemory and call update on it, instead of making a new texture each frame.

imageQuad


Maps a texture onto any four corners, clockwise from the one that gets the texture’s top-left. Skewed cards, fake perspective, a texture stuck to a projected box.

Fonts

ESP text elements accept only the fonts marked in the second column. Want something else? Load any .ttf/.otf as a Font and pass it as font:

Effects

Gradients

Every shape and text takes a gradient option. It replaces the color, spread across the shape’s own bounds, so you never have to pass coordinates.
angle is in radians: 0 runs left to right, Math.PI / 2 top to bottom. "radial" goes from the center (from) out to the edges (to). The shape’s own color still counts for its alpha, so pass "#fff" to keep the gradient as it is, or "#fff8" to make it half transparent.

shadow


A soft shadow of a (rounded) rectangle, the CSS box-shadow kind. Draw it first, then the shape on top. With a bright color and no offset it turns into a glow. Set rounding to half the size and you get a round glow.

blur


Frosted glass: the game behind the box, blurred. It’s the same backdrop the HUD panels use. Put a translucent fill on top and you’ve got a glass panel. It blurs the game only, not other overlay drawings, and shows nothing for the first few frames while the capture starts up.

Groups

Everything drawn between push and pop gets the state you pushed. This is how you animate whole widgets without touching their drawing code. Groups nest: alphas multiply, transforms stack, clips narrow. Clips are in screen pixels and transforms don’t move them. A group you forget to pop is closed once your listener returns, so it never leaks into other scripts.

World space

Shapes placed in the world. Unlike drawing between two worldToScreen points, the part behind the camera gets cut off, so a line running past you still draws up to the edge of the view instead of vanishing. circle3d lies flat on the ground plane, and its radius is in world units.

Screen and projection

screenSize


The overlay size in pixels. It’s a live value, so there’s no named export: read it as render.screenSize.

worldToScreen


World position to overlay pixels. Returns null when the point is behind the camera. Points off to the side still project, to coordinates outside the screen.
World space to screen space
Project inside render, not on the tick, or boxes lag behind when you turn.

screenTransform


Same as worldToScreen, but in normalized device coordinates: -1..1 across the screen, y up. null behind the camera.

boundsOf


The screen rectangle around an entity’s collision bounds, or around a world box. Returns null when the entity is gone or has no bounds, or when any corner is behind the camera.

Example

Boxes and health bars for enemies. Logic on the tick, drawing in render.