Skip to content

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.

tick 0
Draw0
rgb
Draw1
rgb
a
Print2
Print3
Draw4
xy
align
Draw5
xy
imagesize
rotation
Draw Flush6
Stop7
@counter0number

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.

print "Cu: "
print 120
draw print 20 140 @topLeft

The 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.

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.

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.