Files
forgotten_caves/notes/05-ui_renderer.md
T
irrlichtandClaude Opus 5 bb12f095d8 Add bitmap font, UI primitives and a HUD with message log
Ports the CP437 font renderer from wds to the framebuffer: proportional
advance from measured ink bounds, luminance-keyed mask, word wrap. The
right 80 px strip becomes a HUD with name, HP bar, population and a log
fed from sim events; Attacked/Died now carry the type ids the log needs,
since the victim is gone from the world by the time events are read.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 17:31:17 +02:00

22 lines
956 B
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# UI Renderer
## Current state
`game/src/ui.rs` — procedural primitives on the RGB565 framebuffer, all clipped:
`fill_rect`, `draw_rect` (1 px outline), `draw_hbar` (value/max bar).
The HUD (`Game::render_hud` in `game.rs`) lives in the 80 px strip right of the 240×240
viewport: player name, HP bar, population counters, a divider, then the message log
filling the rest bottom-up (newest line always visible, lines wrapped to the panel).
The log is a `VecDeque<String>` fed from `Sim` events in `Game::handle_events`.
Draw order: world, then HUD. The HUD overwrites the right-edge bleed of the tile pass,
which is why there is still no clip-rect on the blit primitives.
## Open questions
- Tileset-based borders vs. line-drawing: line-drawing for now (`draw_rect`); a 9-slice
ornament frame like `wds` has is an option once the look matters.
- Does the message log need scrolling? Not yet — `LOG_LINES` keeps 40, the panel shows
what fits.