Interface DrawTarget
Draw) or into a batch (DrawFrame).
The primitives live here as defaults so the two destinations cannot drift
apart: draw.rect(...) and frame.rect(...) are the same code,
differing only in where submit(DrawCommand) puts the result.
-
Method Summary
Modifier and TypeMethodDescriptiondefault HighlightBuilderarea(int tileX, int tileY, int widthTiles, int heightTiles, int plane) Highlight a block of ground under the conventional auto keyarea:<x>:<y>:<w>:<h>:<plane>.default HighlightBuilderHighlight awidthTilesbyheightTilesblock of ground, anchored at its minimum corner, all in whole tiles.default DrawCaptionBuildercomponent(int interfaceId, int componentId) Highlight an interface component under the conventional auto keycomp:<iface>:<comp>.default DrawCaptionBuilderHighlight an interface component under a key you choose.default DrawBuilderEllipse inscribed in the given rectangle.default HighlightBuilderHighlight an entity by list and server index — the general form the three named entity helpers funnel through, for a caller holding an index without a snapshot row to go with it.default HighlightBuilderentity(String, EntityRef, int)with a footprint in tiles.default DrawBuilderStraight segment from(x1, y1)to(x2, y2).default HighlightBuilderHighlight an NPC under the conventional auto keynpc:<index>.default HighlightBuilderHighlight an NPC, tracked.default HighlightBuilderHighlight an NPC, tracked, with a footprint in tiles.default HighlightBuilderHighlight another player under the conventional auto keyplayer:<index>.default HighlightBuilderHighlight another player, tracked.default DrawBuilderPolyline over a flat[x, y, x, y, ...]list.default DrawBuilderAxis-aligned rectangle.default HighlightBuilderself()Highlight the local player under the conventional auto keyself.default HighlightBuilderHighlight the local player, tracked.submit(DrawCommand command) Route a fully-built command, answering the key it is stored under.default DrawCaptionBuilderA caption anchored at(x, y), drawn as-is.default HighlightBuildertile(int tileX, int tileY, int plane) Highlight one game tile under the conventional auto keytile:<x>:<y>:<plane>.default HighlightBuilderHighlight one game tile on the ground floor, in whole tiles.default HighlightBuilderHighlight one game tile on a named plane, in whole tiles.default DrawCaptionBuilderA scaled number anchored at(x, y):value(key, x, y, 1234, 2)draws"12.34".
-
Method Details
-
submit
Route a fully-built command, answering the key it is stored under.The plumbing seam the fluent builders call, and the escape hatch for a caller holding a
DrawCommandit built or stored itself. -
line
Straight segment from(x1, y1)to(x2, y2). -
rect
Axis-aligned rectangle. Stroked unlessDrawBuilder.filled(). -
ellipse
Ellipse inscribed in the given rectangle. -
text
A caption anchored at(x, y), drawn as-is.Returns a
DrawCaptionBuilder, sofont(...)andvalue(...)are reachable here and nowhere a shape can see them. -
value
A scaled number anchored at(x, y):value(key, x, y, 1234, 2)draws"12.34".There is no float anywhere on this wire, deliberately. Send a scaled integer and say what you scaled it by.
-
poly
Polyline over a flat[x, y, x, y, ...]list. -
component
Highlight an interface component under a key you choose. The producer re-resolves the rect every tick, so the highlight follows the component rather than drifting when the UI relays out. -
component
Highlight an interface component under the conventional auto keycomp:<iface>:<comp>.The key is computed here rather than left to the producer, so it is known before the command is sent and
DrawBuilder.submit()can answer it. A caller who never learns the key cannot clear the highlight;DrawCommand.ComponentTarget.autoKey(int, int)is the same format, exposed for anyone predicting it. -
npc
Highlight an NPC, tracked. The box follows the NPC as it walks, and sits at the NPC's own height rather than the local player's.This is the call the older, worse version of this helper was a placeholder for. It used to send a world-space rect at the tile the NPC occupied when it was called, which marked a position: the box stayed put once the NPC moved, and it carried no plane, so an NPC upstairs was marked on the ground floor. Its javadoc promised that binding the producer's semantic highlight would "change what this sends rather than how it is called". This is that change, and the promise held for the name and the arguments.
Migrating: the return type moved from
DrawBuildertoHighlightBuilder. A chained call is unaffected —draw.npc(key, npc).color(...).ttl(...).submit()compiles and reads exactly as before. What no longer compiles is assigning the result to aDrawBuildervariable, and callingscreen(),world()orclosed()on it: a highlight's space is not a caller's choice, so offering it would be offering a decision that does not exist. Where you held the builder in a local, change its type; the fluent methods you were calling are all still there.Footprint defaults to one tile. Use
npc(String, Npc, int, int)for a big NPC, or the box will sit inside it. -
npc
Highlight an NPC, tracked, with a footprint in tiles. -
npc
Highlight an NPC under the conventional auto keynpc:<index>.The key is computed here rather than left to the producer, so it is known before the command is sent and
HighlightBuilder.submit()can answer it — a caller who never learns the key cannot clear the highlight.DrawCommand.Entity.autoKey(EntityRef, int)is the same format, exposed for anyone predicting it. -
player
Highlight another player, tracked. Same contract asnpc(String, Npc). -
player
Highlight another player under the conventional auto keyplayer:<index>. -
self
Highlight the local player, tracked.Takes no index and stores none: the producer re-resolves the local player's list slot every tick, so this survives a world hop that would leave a stored index pointing at whoever took the seat.
-
self
Highlight the local player under the conventional auto keyself. -
entity
Highlight an entity by list and server index — the general form the three named entity helpers funnel through, for a caller holding an index without a snapshot row to go with it.Exactly one list is named, which is why
EntityRefis a parameter rather than two nullable ones: the producer refuses bothnpcandplayertogether and refuses neither, because "which wins" is not a rule a caller could guess from a reply that succeeded. NPC 42 and player 42 are different entities. -
entity
default HighlightBuilder entity(String key, EntityRef ref, int serverIndex, int widthTiles, int heightTiles) entity(String, EntityRef, int)with a footprint in tiles. -
tile
Highlight one game tile on the ground floor, in whole tiles.Kept at this signature because it already had it — this is the same call, now sending
highlight_tileinstead of a world-space rect, which is what its old javadoc said binding the highlight would do. It still lands on plane 0 for the same reason it did before: no plane was ever sent. Prefertile(String, int, int, int)and pass the plane you mean.Note the unit change against the primitives: this takes tiles, while
rect(...).world()at the same place takestile *DrawLimits.SUBTILE_SCALE. That split is the producer's and its handler is the one place the two meet. -
tile
Highlight one game tile on a named plane, in whole tiles.A plane other than the one the local player is standing on draws nothing. Not an error — the call is accepted and stored — but it resolves
unavailable, because the producer's only ground-height source is the player's own elevation and it refuses rather than placing a marker convincingly wrong on the player's floor.npc(String, Npc)and the other entity highlights are the exemption, because an entity carries its own height. SeeDrawCommand.Tile. -
tile
Highlight one game tile under the conventional auto keytile:<x>:<y>:<plane>. -
area
default HighlightBuilder area(String key, int tileX, int tileY, int widthTiles, int heightTiles, int plane) Highlight awidthTilesbyheightTilesblock of ground, anchored at its minimum corner, all in whole tiles.The separate call rather than a
w/hontile(String, int, int), becausehighlight_tilerefuses an extent rather than dropping one — a silently-ignoredwis how a caller ends up convinced a 5x5 highlight rendered as 1x1 because of a projection bug. Carries the same plane rule astile(String, int, int, int). -
area
Highlight a block of ground under the conventional auto keyarea:<x>:<y>:<w>:<h>:<plane>.
-