pbio moves to git.bnd.wtf/irrlicht/pbio.git branch truecolor16: the framebuffer is now RGB565 u16, no palette. Assets are loaded from PNG via the png crate and quantized to RGB565 on load; transparency comes from the alpha channel as a per-tile opacity mask, so any color (black included) can be opaque. The TGA loader and the palette-order fragility are gone. overworld.png is the unmodified Mini-Medieval Overworld sheet (same 24-column layout as the old TGA, so map tile ids are unchanged); entities.png holds the player sprite extracted from the old entities.tga. Adds an ignored snapshot test that renders the first frame headlessly to a PNG for eyeballing the renderer without a window. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
31 lines
1.1 KiB
Markdown
Executable File
31 lines
1.1 KiB
Markdown
Executable File
# Text Renderer
|
||
|
||
## Current state
|
||
|
||
No text rendering exists yet. No font loading or glyph blitting code exists.
|
||
|
||
## Goal
|
||
|
||
Draw ASCII text into the RGB565 framebuffer using a bitmap font.
|
||
|
||
## Design notes
|
||
|
||
- A bitmap font is the right fit: each glyph is a small masked tile, blitted
|
||
directly into the framebuffer using the existing blit primitive in `pixelhelper.rs`.
|
||
- Likely approach: a fixed 8×8 or similar glyph grid packed into a PNG,
|
||
one glyph per ASCII codepoint starting at 0x20 (space).
|
||
- The font image only needs its alpha mask: glyph pixels are opaque, background transparent;
|
||
the caller supplies the color and `draw_text` paints the mask with it.
|
||
- API sketch:
|
||
```rust
|
||
fn draw_text(frame: &mut [u16], font: &Font, x: i32, y: i32, color: u16, text: &str);
|
||
```
|
||
- `Font` holds the glyph sheet as an `Image` plus glyph width/height.
|
||
|
||
## Open questions
|
||
|
||
- How do we handle proportional spacing of different characters?
|
||
- How do we store font data in memory?
|
||
- How do we handle font color rendering?
|
||
- How do we handle special characters like Ä, Ö, Ü, ß, etc.?
|