Shapes and lines
There are six shapes, and each asks for its own numbers: a corner here, a centre there, a radius elsewhere
Everything the display can do is drawn here: a fill and an outline, a line, a hexagon, a triangle in outline and a triangle filled.
What each shape asks for
Section titled “What each shape asks for”| Command | Fields | What it counts from |
|---|---|---|
rect |
x y width height |
the bottom left corner |
lineRect |
x y width height |
the same, but in outline |
line |
x1 y1 x2 y2 |
point to point |
poly |
x y sides radius rotation |
from the centre |
linePoly |
x y sides radius rotation |
the same, in outline |
triangle |
x1 y1 x2 y2 x3 y3 |
three vertices |
That difference in what a shape counts from is the most common cause of “it drew in the wrong place”. For a rectangle it is a corner, for a polygon the centre.
Line thickness
Section titled “Line thickness”draw stroke 4stroke sets the thickness of everything drawn in outline: line, lineRect, linePoly.
Like the colour, it holds until the next stroke, and it does not affect fills at all.
Rotating a polygon
Section titled “Rotating a polygon”The fifth field of poly is an angle in degrees, and it is counted as everywhere in mlog:
counter-clockwise, with zero pointing right.
draw poly 88 88 3 40 0draw poly 88 88 3 40 180Two triangles from the same point, rotated relative to each other — a star. Half the pictures on displays are built on that.
Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.