text, bar, or rect with a
screen position and style. You add them, list them, and clear them over HTTP; a render host draws the
canvas every frame. The element model is fully headless; only turning those elements into pixels
needs a GPU. The catch this page makes explicit: the canvas itself is a world resource the host owns,
and the minimal server doesn’t register one — so adds return ok:true but the list stays empty. Every
command is real and runnable against a local server; output is captured from one.
Build a HUD
1. Add a text element. The body is a taggedHudElement — type:"text" plus a position, size,
and color name:
type:"bar" element with a fill in [0, 1] — a health or progress bar:
HudCanvas resource is registered to receive the adds:
HudCanvas (the editor and game hosts do), the same two adds populate
it, and /ui/list returns each element as a tagged value — e.g.
{"elements":[{"type":"text","text":"Score: 3","x":20.0,"y":20.0,"size":24.0,"color":"white"}], "count":1}.
4. Clear the HUD. Removes all elements; this one reports a message regardless:
Behavior and gotchas
The things you only find out by running it:ok:truefrom/ui/textand/ui/bardoes not mean added. Like templates, these only push onto the canvas if aHudCanvasresource exists (if let Some(canvas) = …). On the bare server the add is silently dropped and still returnsok:true. Trust/ui/list, not the add response./ui/clearalways reports a message ({"ok":true,"message":"HUD cleared"}) even with no canvas — it’s the one HUD endpoint that returns a message, but it clears only the canvas the host owns.- The element body is a tagged enum.
typeis required and selects the variant:text(text,x,y,size,color),bar(x,y,width,height,fill,color), orrect(x,y,width,height,color). Color is a name string ("white","green"), not an array. - No
/stepneeded. Adding, listing, and clearing are immediate; the HUD canvas is mutated on the call, not on a tick. - Layout and draw live above this surface. The richer
euca-uiflex layout, button hit-testing, and world-space projection resolve in the engine, but the HTTP surface here is the flat HUD element list; drawing it (fonts, quads) is the render host’s job.
Endpoints
Status
- Shipped & headless — the HUD element model (
text/bar/rect), the add/list/clear logic, and the canvas resource type. The fulleuca-uiflex layout and input routing run headless too. - Host-dependent — the
HudCanvasresource itself. The minimal example server doesn’t register one, so adds no-op and/ui/listis empty; a host that registers aHudCanvasmakes the add→list→clear loop work. Drawing the canvas to the screen needs a render host.
UI & HUD endpoints
HUD text, bar, list, and clear endpoints, with request and response schemas.