Drawing Functions
Functions for rendering 2D overlays and graphics on top of the game world.
Summary
All drawing functions render to an overlay on the game screen. Coordinates are screen-space (0,0 is top-left). Drawing commands are queued and rendered on the next frame. Use draw_clear() to reset.
draw_line
Draws a line between two points.
| Lua | |
|---|---|
Parameters:
- x1, y1 (number): Start position
- x2, y2 (number): End position
- r, g, b, a (number): RGBA color (0-255)
- thickness (number): Line thickness
Example:
draw_rect
Draws a rectangle (outline or filled).
| Lua | |
|---|---|
Parameters:
- x, y (number): Top-left corner
- w, h (number): Width and height
- r, g, b, a (number): RGBA color (0-255)
- thickness (number): Line thickness (ignored if filled)
- filled (number): 1=filled, 0=outline
draw_circle
Draws a circle (outline or filled).
| Lua | |
|---|---|
Parameters:
- x, y (number): Center position
- radius (number): Circle radius
- r, g, b, a (number): RGBA color (0-255)
- thickness (number): Line thickness (ignored if filled)
- segments (number): Number of segments (higher = smoother)
- filled (number): 1=filled, 0=outline
draw_text
Draws text on screen.
| Lua | |
|---|---|
Parameters:
- x, y (number): Text position
- r, g, b, a (number): RGBA color (0-255)
- text (string): Text to display
draw_clear
Clears all pending draw commands.
| Lua | |
|---|---|
Example: