Text and pictures
Text reaches a display from the same buffer that feeds a message block — but not every letter survives the trip
A display has no separate “write this text” command. Text is first piled up with print in
the processor’s buffer — the very same one printflush takes it from — and then carried onto
the picture by the draw print command.
A caption at the top left, the copper icon in the middle. The order of the lines matters here:
print fills the buffer, draw print takes it.
draw print x y alignment
Section titled “draw print x y alignment”print "Cu: "print 120draw print 20 140 @topLeftThe first two fields are a point on the display, the third is which side of that point the
caption sits on: @topLeft means “the point is its top left corner”. There are nine choices in
all: @center, @top, @bottom, @left, @right and the four corners.
Not every letter exists on a display
Section titled “Not every letter exists on a display”An item’s icon instead of a caption
Section titled “An item’s icon instead of a caption”draw image 88 70 @copper 40 0| Field | What is in it |
|---|---|
| first and second | the centre of the picture |
| third | what to draw: @copper, @router, @poly — any content |
| fourth | the side’s size in dots |
| fifth | rotation in degrees |
Anything with an icon can be drawn: items, liquids, blocks, unit types. That is the usual way to label a reading without letters — the copper icon with a number beside it.
Every letter is a separate command
Section titled “Every letter is a separate command”This matters for the next lesson: draw print is not one command but as many commands as
there are characters in the caption. The caption Cu: 120 is six commands in the processor’s
buffer (the space is skipped), and that buffer is not endless.
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.