draw
Let's you draw things to the screen.
Methods
draw.text(content, pos, color, fontSize, fontName)
draw.text(content, pos, color, fontSize, fontName)
content
- The text you wish to drawpos
- The screen position where to draw the text as a Vec2color
- The color of the text as a Vec4, e.g. Vec4:new(255, 0, 0, 255) for red with 100% alphafontSize
- The size of the text in pixelsfontName
- The name of the font
Available Font sizes:
12, 14, 16, 18, 24, 32, 36, 48, 60
Available Fonts:
Verdana
VerdanaBold
Impact
Beyblade
Dameron
RobotoMono-Light
Draws text at a position.
Example:
function render()
draw.text("Hey", Vec2:new(200, 200), Vec4:new(255, 0, 0, 255), 60, "Verdana")
end
engine.addEventListener("render", render)

draw.line(start, end, color, thickness)
draw.line(start, end, color, thickness)
start
- Start position of the line as a Vec2end
- End Position of the line as a Vec2color
- The color of the line as a Vec4, e.g. Vec4:new(255, 0, 0, 255) for red with 100% alphathickness
- The thickness of the line in pixels
Draws a line from point A to B.
Example:
function render()
draw.line(Vec2:new(200,300), Vec2:new(500, 500), Vec4:new(255, 0, 0, 255), 2, "Verdana")
end
engine.addEventListener("render", render)

draw.rectangle(topLeft, botRight, color, rounding)
draw.rectangle(topLeft, botRight, color, rounding)
topLeft
- Top left corner as a Vec2botRight
- Bottom right corner as a Vec2color
- The color of the rect as a Vec4, e.g. Vec4:new(255, 0, 0, 255) for red with 100% alpharounding
- Edge rounding in pixels
Draws a rectangle spanning from topLeft
to botRight
.
Example:
function render()
draw.rectangle(Vec2:new(200,200), Vec2:new(250, 300), Vec4:new(255, 0, 0, 255), 0)
end
engine.addEventListener("render", render)

draw.rectangleFilled(start, end, color, thickness)
draw.rectangleFilled(start, end, color, thickness)
topLeft
- Top left corner as a Vec2botRight
- Bottom right corner as a Vec2color
- The color of the rect as a Vec4, e.g. Vec4:new(255, 0, 0, 255) for red with 100% alpharounding
- Edge rounding in pixels
Draws a filled rectangle spanning from topLeft
to botRight
.
Example:
function render()
draw.rectangleFilled(Vec2:new(200,200), Vec2:new(250, 300), Vec4:new(255, 0, 0, 255), 0)
end
engine.addEventListener("render", render)

draw.circle(center, radius, color, segments)
draw.circle(center, radius, color, segments)
center
- The center of the circle as a Vec2radius
- The radius of the circle in pixelscolor
- The color of the circle as a Vec4, e.g. Vec4:new(255, 0, 0, 255) for redsegments
- The circle is made up of lines, the more segments the smoother
Draws a circle.
Example:
function render()
draw.circle(Vec2:new(200,300), 60, Vec4:new(255, 0, 0, 255), 20)
end
engine.addEventListener("render", render)

draw.circleFilled(center, radius, color, segments)
draw.circleFilled(center, radius, color, segments)
center
- The center of the circle as a Vec2radius
- The radius of the circle in pixelscolor
- The color of the circle as a Vec4, e.g. Vec4:new(255, 0, 0, 255) for redsegments
- The circle is made up of lines, the more segments the smoother
Draws a filled circle.
Example:
function render()
draw.circleFilled(Vec2:new(200,300), 60, Vec4:new(255, 0, 0, 255), 20)
end
engine.addEventListener("render", render)

Last updated