Skip to main content

Drawing Shapes

For drawing shapes into the screen using code.

color

Set the active color

color(colorId)
ParameterTypeDefaultNote
colorIdnumber⚠️ requiredinteger in range [0, 15].

Get the active color

id = color()
ReturnTypeNote
colorIdnumberinteger in range [0, 15].

clear

Clear the screen and fills it with a specific color, useful when clearing the screen for a new frame.

clear(colorId)
ParameterTypeDefaultNote
colorIdnumberactive colorinteger in range [0, 15].

point

Draw point(s) on the screen.

point(x, y, ..., colorId)
ParameterTypeDefaultNote
xnumber⚠️ required
ynumber⚠️ required
...numbervarargspairs of numbers which are coordinates for other points to draw in the same call.
colorIdnumberactive colorinteger in range [0, 15].

line

Draw a line(s) on the screen.

line(x1, y1, x2, y2, ..., colorId)
ParameterTypeDefaultNote
x1number⚠️ required
y1number⚠️ required
x2number⚠️ required
y2number⚠️ required
...numbervarargs
colorIdnumberactive colorinteger in range [0, 15].

circle

Draw a circle on the screen.

The arguments can be passed in a table.

circle(centerX, centerY, radius, isOutlineOnly, colorId, segmentsCount)
ParameterTypeDefaultNote
centerXnumber⚠️ required
centerYnumber⚠️ required
radiusnumber⚠️ required
isOutlineOnlybooleanfalse
colorIdnumberactive colorinteger in range [0, 15].
segmentsCountnumberdetermined by system

ellipse

Draw an ellipse on the screen.

The arguments can be passed in a table

ellipse(centerX, centerY, radiusX, radiusY, isOutlineOnly, colorId, segmentsCount)
ParameterTypeDefaultNote
centerXnumber⚠️ required
centerYnumber⚠️ required
radiusXnumber⚠️ required
radiusYnumber⚠️ required
isOutlineOnlybooleanfalse
colorIdnumberactive colorinteger in range [0, 15].
segmentsCountnumberdetermined by system

triangle

Draw a triangle on the screen.

The arguments can be passed in a table

triangle(x1, y1, x2, y2, x3, y3, l, c)
ParameterTypeDefaultNote
x1number⚠️ requiredfirst vertex.
y1number⚠️ requiredfirst vertex.
x2number⚠️ requiredsecond vertex.
y2number⚠️ requiredsecond vertex.
x3number⚠️ requiredthird vertex.
y3number⚠️ requiredthird vertex.
isOutlineOnlybooleanfalse
colorIdnumberactive colorinteger in range [0, 15].

rect

Draw a rectangle on the screen.

The arguments can be passed in a table

rect(x, y, width, height, isOutlineOnly, colorId)
ParameterTypeDefaultNote
xnumber⚠️ required
ynumber⚠️ required
widthnumber⚠️ required
heightnumber⚠️ required
isOutlineOnlybooleanfalse
colorIdnumberactive colorinteger in range [0, 15].

polygon

Draw a polygon on the screen.

polygon(x1, y1, x2, y2, x3, y3, ..., colorId)
ParameterTypeDefaultNote
x1number⚠️ requiredfirst vertex.
y1number⚠️ requiredfirst vertex.
x2number⚠️ requiredsecond vertex.
y2number⚠️ requiredsecond vertex.
x3number⚠️ requiredthird vertex.
y3number⚠️ requiredthird vertex.
...numbervarargspairs of coordinates for other vertices of the polygon.
colorIdnumberactive colorinteger in range [0, 15].