Reorganize assets; switch the HUD to the Micro Chat font

Source packs move to assets/packs (untouched), maps to assets/maps, and the
palette/sketch leftovers from the 8-bit era go. tools/mkfont.py repacks
VEXED's Micro Chat sheet (8-column grid, 8x10 cells) into the CP437 atlas
layout the font loader already reads, cropped to 8x9 so the HUD can use an
8 px line height. The CGA atlas is dropped in its favor.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 19:47:33 +02:00
co-authored by Claude Opus 5
parent bb12f095d8
commit 335962800f
111 changed files with 528 additions and 546 deletions
+5 -5
View File
@@ -140,13 +140,13 @@ pub fn cp437(ch: char) -> u8 {
mod tests {
use super::*;
fn cga() -> Font {
Font::from_png(concat!(env!("CARGO_MANIFEST_DIR"), "/../assets/fonts/cga-8x8.png"), 8, 8)
fn font() -> Font {
Font::from_png(concat!(env!("CARGO_MANIFEST_DIR"), "/../assets/fonts/micro-chat-8x9.png"), 8, 9)
}
#[test]
fn measures_ink_and_advances_proportionally() {
let f = cga();
let f = font();
assert_eq!(f.width[b' ' as usize], 0);
assert!(f.width[b'i' as usize] < f.width[b'M' as usize]);
assert_eq!(f.text_width(" "), 4);
@@ -155,7 +155,7 @@ mod tests {
#[test]
fn draws_only_ink_in_the_given_color() {
let f = cga();
let f = font();
let mut frame = vec![0u16; 32 * 8];
let end = f.draw(&mut frame, 32, 0, 0, 0xFFFF, "I");
assert_eq!(end, f.width[b'I' as usize] as i32 + 1);
@@ -167,7 +167,7 @@ mod tests {
#[test]
fn wraps_on_width_and_hard_newlines() {
let f = cga();
let f = font();
let w3 = f.text_width("aaa");
assert_eq!(f.wrap("aaa bbb ccc", w3), vec!["aaa", "bbb", "ccc"]);
assert_eq!(f.wrap("aaa bbb ccc", f.text_width("aaa bbb")), vec!["aaa bbb", "ccc"]);
+4 -4
View File
@@ -58,7 +58,7 @@ const SPRITE_FOX: u16 = 2;
const HUD_X: i32 = VIEW_PX;
const HUD_W: i32 = 320 - VIEW_PX;
const HUD_PAD: i32 = 3;
const LINE_H: i32 = 9;
const LINE_H: i32 = 8;
const HUD_BG: u16 = pbio::rgb565(16, 12, 24);
const HUD_FRAME: u16 = pbio::rgb565(120, 100, 140);
const HUD_TEXT: u16 = pbio::rgb565(235, 235, 255);
@@ -108,7 +108,7 @@ impl Game {
pub fn start(map_path: &str) -> Self {
let tileset = Image::from_png("assets/tilesets/overworld.png").to_tileset();
let entity_tileset = Image::from_png("assets/tilesets/entities.png").to_tileset();
let font = Font::from_png("assets/fonts/cga-8x8.png", 8, 8);
let font = Font::from_png("assets/fonts/micro-chat-8x9.png", 8, 9);
let t0 = std::time::Instant::now();
let map = TileMap::from_csv(map_path);
@@ -568,7 +568,7 @@ mod snapshot {
fn population() {
std::env::set_current_dir("..").unwrap();
let secs: usize = std::env::var("SECONDS").ok().and_then(|s| s.parse().ok()).unwrap_or(60);
let mut g = super::Game::start("assets/map_test");
let mut g = super::Game::start("assets/maps/map_test");
let input = crate::input::InputState::new();
let mut frame = vec![0u16; 320 * 240];
for _ in 0..secs * 60 {
@@ -585,7 +585,7 @@ mod snapshot {
#[ignore]
fn dump_frame() {
std::env::set_current_dir("..").unwrap();
let map = std::env::var("SNAPSHOT_MAP").unwrap_or_else(|_| "assets/map_test".into());
let map = std::env::var("SNAPSHOT_MAP").unwrap_or_else(|_| "assets/maps/map_test".into());
let mut g = super::Game::start(&map);
let input = crate::input::InputState::new();
let mut frame = vec![0u16; 320 * 240];
+2 -2
View File
@@ -21,8 +21,8 @@ fn main() {
let input_map = input::InputMap::new();
let mut input_state = input::InputState::new();
let mut last_update = Instant::now();
// Optional map path: `game assets/map_large`.
let map_path = std::env::args().nth(1).unwrap_or_else(|| "assets/map_test".into());
// Optional map path: `game assets/maps/map_large`.
let map_path = std::env::args().nth(1).unwrap_or_else(|| "assets/maps/map_test".into());
let mut game = game::Game::start(&map_path);
while !plat.should_close() {