Class DrawBuilder
draw.rect("target-box", x, y, w, h).color(Colors.GREEN).thickness(2).ttl(1200).submit();
Mutable and single-use by convention — submit() may be called more
than once, and each call re-sends the same key, which the producer treats as a
replace. Nothing is put on the wire until submit().
Obtained from a DrawTarget: either Draw (each submit is its
own round-trip) or DrawFrame (submits accumulate and leave as one
batch). The chain reads identically either way, which is the point.
-
Method Summary
Modifier and TypeMethodDescriptionalpha(int alpha) The current colour at a different 0..255 alpha.build()The command as configured, without sending it.closed()Close a polyline back to its first point.color(int argb) Packed0xAARRGGBB.filled()Fill rather than stroke.filled(boolean fill) Fill or stroke explicitly.screen()Client-area pixels, origin top-left.submit()Send the command, and answer the key it is stored under — which is also how you clear it later.thickness(int pixels) Stroke width,DrawLimits.MIN_THICKNESStoDrawLimits.MAX_THICKNESS.ttl(long milliseconds) Lifetime in milliseconds.Lifetime as aDuration, truncated to whole milliseconds.Keep this command until it is replaced, cleared, or the script's connection closes.world()Game-world coordinates, projected to the screen by the producer.z(int order) Draw order; higher is drawn in front.
-
Method Details
-
color
Packed0xAARRGGBB. SeeColors. -
alpha
The current colour at a different 0..255 alpha. -
thickness
Stroke width,DrawLimits.MIN_THICKNESStoDrawLimits.MAX_THICKNESS. -
filled
Fill rather than stroke. Meaningful for rect, ellipse and poly. -
filled
Fill or stroke explicitly. -
closed
Close a polyline back to its first point. Meaningful for poly only. -
z
Draw order; higher is drawn in front. -
ttl
Lifetime in milliseconds. The default isDrawLimits.DEFAULT_TTL_MSand it is always sent explicitly, soDraw.list()reports the lifetime this command actually got. -
ttl
Lifetime as aDuration, truncated to whole milliseconds. -
untilCleared
Keep this command until it is replaced, cleared, or the script's connection closes. It is not a way to leave something on screen after the script stops: ownership is connection-scoped and the producer drops everything a connection drew when its pipe closes. -
screen
Client-area pixels, origin top-left. The default. -
world
Game-world coordinates, projected to the screen by the producer. Bounded byDrawLimits.MAX_WORLD_COORDINATErather than the screen bound, and refused for aDrawKind.POLY. SeeDrawSpace.WORLD. -
build
The command as configured, without sending it.The return type narrowed from
DrawCommandtoDrawCommand.Primitive. Source-compatible — aPrimitiveis aDrawCommand, so every existing use still compiles — but not binary compatible, so a script compiled against an olderbot-apineeds a rebuild. The narrowing is what letsdrawSetBatchtakeList<Primitive>and so refuse a highlight at compile time; this builder never built anything else. -
submit
Send the command, and answer the key it is stored under — which is also how you clear it later. Inside aDrawFramethis only queues; the wire traffic happens when the frame is flushed or closed.A command the producer refuses propagates the transport's own unchecked RPC error when submitted through
Draw, and is counted intoDrawBatchResult.dropped()when submitted through aDrawFrame. The two failure shapes differ because the wire's do — seeDrawFrame.flush().
-