Skip to main content
Euca’s UI framework (euca-ui) is renderer-agnostic: it resolves a flex layout into screen-space rects, emits draw commands, and routes input via hit-testing. Layout, hit-testing, and interaction state all run headless; only the final draw needs a GPU host. The HTTP surface focuses on the HUD — text and bars you add, list, and clear.
Headless layout + input, GPU draw. Layout solving, anchor/flex math, button hit-testing, and input consumption run on the :3917 server. Game logic can poll button states without rendering. Only drawing the quads and text needs a render host.

What it does

  • LayoutUiNode with anchors (TopLeftStretch), Val::Px / Percent / Auto sizing, margins, and flex (FlexDirection, JustifyContent, AlignItems); ui_layout_system resolves to ResolvedRect screen pixels.
  • WidgetsUiText, UiButton (hovered/pressed/clicked state), UiProgressBar, UiImage, UiPanel.
  • Input routingui_input_system hit-tests the cursor against resolved rects, updates button state, and sets a UiInputConsumed flag so gameplay input can defer to the UI.
  • World-space UI — entities with UiNode + GlobalTransform project a 3D position to screen via the view-projection matrix (health bars over units, etc.).
  • Draw outputcollect_ui_draw_data emits sorted UiDrawCommands (Rect/Text/Image/ ProgressBar) for the renderer.

Endpoints

MethodPathDescription
POST/ui/textAdd a text element to the HUD
POST/ui/barAdd a bar (progress/health) to the HUD
GET/ui/listList current HUD elements (type, position, size)
POST/ui/clearRemove all HUD elements

Example

# Add a HUD title and a health bar, then read them back
curl -s -X POST http://localhost:3917/ui/text \
  -H 'Content-Type: application/json' \
  -d '{"text":"Round 1","x":20,"y":20,"size":24,"color":[1,1,1,1]}'

curl -s -X POST http://localhost:3917/ui/bar \
  -H 'Content-Type: application/json' \
  -d '{"x":20,"y":56,"width":200,"height":16,"value":0.75,"color":[0.2,0.8,0.2,1]}'

curl -s http://localhost:3917/ui/list

Status

  • ✅ Flex layout, anchors, all widget types, button hit-testing, input consumption, world-space projection, draw-command emission — shipped and headless. Drawing the commands needs a render host; fonts/textures are uploaded by the renderer.

UI & HUD endpoints

HUD text, bar, list, and clear endpoints with schemas.