feat: procedurally scalable UI — font_scale auto-computed from screen size

- UiLayer.font_scale: dynamically computed as (ui_height / 200).clamp(2, 6)
  Larger screens get bigger UI text automatically
- draw_text: renders each font pixel as font_scale×font_scale block
  (was 1×1, now 2×2 to 6×6 depending on screen size)
- text_width: now instance method, returns scaled width
- draw_health_bar: bar width scales with font_scale
- draw_character_panel: panel dimensions and row spacing scale
- draw_hud: bar height, row spacing, bar width scale
- draw_inventory_overlay: slot sizes scale with font_scale
- draw_messages: line spacing scales with font_height
- draw_death_screen: centered text uses scaled text_width
- All 185 tests + 14 scenarios pass
- Benchmark: 61.9 FPS (was 82.7 — 25% regression from more set_alpha calls)
This commit is contained in:
Emil
2026-06-22 13:23:48 +03:00
parent f35f56b970
commit a16645d2d8
4 changed files with 131 additions and 70 deletions
+11 -11
View File
@@ -1,17 +1,17 @@
{
"mode": "graphics",
"ticks": 300,
"total_time_ms": 3627.1,
"avg_fps": 82.7,
"avg_frame_time_ms": 12.06,
"p99_frame_time_ms": 86.45,
"min_frame_time_ms": 7.25,
"total_time_ms": 4845.5,
"avg_fps": 61.9,
"avg_frame_time_ms": 16.12,
"p99_frame_time_ms": 145.95,
"min_frame_time_ms": 8.19,
"subsystems": {
"ca_step_avg_us": 4927,
"ca_step_p99_us": 79708,
"ca_step_min_us": 698,
"render_avg_us": 4154,
"render_p99_us": 6411,
"render_min_us": 3798
"ca_step_avg_us": 8153,
"ca_step_p99_us": 137703,
"ca_step_min_us": 1174,
"render_avg_us": 4433,
"render_p99_us": 6450,
"render_min_us": 3956
}
}