Switch to 16-bit truecolor framebuffer and PNG assets
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>
This commit is contained in:
co-authored by
Claude Opus 5
parent
64a6e1d42d
commit
5a055c048d
@@ -6,20 +6,19 @@ No text rendering exists yet. No font loading or glyph blitting code exists.
|
||||
|
||||
## Goal
|
||||
|
||||
Draw ASCII text into the `u8` framebuffer using a bitmap font, respecting the palette-index
|
||||
color model (one u8 per pixel, no RGBA).
|
||||
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 tile of palette indices, blitted
|
||||
- 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 TGA or raw binary,
|
||||
- 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 itself should be indexed: foreground pixels carry a nonzero palette index
|
||||
(caller supplies the color), background pixels are index 0 (transparent/skip).
|
||||
- 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 [u8], font: &Font, x: i32, y: i32, color: u8, text: &str);
|
||||
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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user