aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/mission_hints.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-01 21:32:55 +0300
committerValentin Popov <valentin@popov.link>2026-12-01 21:32:55 +0300
commitb48fb2caccc7a72b85f07e6ab652081af57c7855 (patch)
tree851858e8881e9c0ba1892b1173212092b53ff86c /apps/fparkan-game/src/mission_hints.rs
parent6954eb74b535341bed234091e67f62ed13266c25 (diff)
downloadfparkan-b48fb2caccc7a72b85f07e6ab652081af57c7855.tar.xz
fparkan-b48fb2caccc7a72b85f07e6ab652081af57c7855.zip
feat(ui): render mission hints with the original game font
Resolve the witnessed 800x600 GAME_FONT through the installed resource configuration. Draw CP1251 bytes from the Tfnt atlas using the original variable-width metrics. Checked the original measurement routine and the first Constructor hint in the game window.
Diffstat (limited to 'apps/fparkan-game/src/mission_hints.rs')
-rw-r--r--apps/fparkan-game/src/mission_hints.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/fparkan-game/src/mission_hints.rs b/apps/fparkan-game/src/mission_hints.rs
index 9e6e2055..3ec9c440 100644
--- a/apps/fparkan-game/src/mission_hints.rs
+++ b/apps/fparkan-game/src/mission_hints.rs
@@ -4,6 +4,7 @@ use super::{
EnvironmentGpuRange, LegacyBlendMode, LegacyDepthMode, StaticPreviewScene, Vfs,
VulkanSmokeRenderer, VulkanStaticMesh, VulkanStaticTexture,
};
+use fparkan_assets::game_font::{load_game_font, BitmapFont};
use fparkan_path::{normalize_relative, PathPolicy};
use fparkan_platform_winit::text::{caption, StringResources};
use fparkan_runtime::MissionScriptOutcome;
@@ -48,6 +49,7 @@ struct MessageResources {
catalog: Arc<[u8]>,
strings: StringResources,
sender_strings: Option<StringResources>,
+ font: BitmapFont,
}
impl MissionHints {
@@ -163,7 +165,12 @@ impl MissionHints {
self.active = None;
if pager_visible(message.posted_ms, clock) {
let index = message.index;
- let (height, rgba) = match caption(&message.body, WIDTH, HEIGHT) {
+ let font = &self
+ .messages
+ .as_ref()
+ .expect("posted message resources")
+ .font;
+ let (height, rgba) = match font.caption(&message.body, WIDTH, HEIGHT) {
Ok(caption) => caption,
Err(error) => {
eprintln!(
@@ -266,6 +273,7 @@ impl MessageResources {
catalog,
strings,
sender_strings,
+ font: load_game_font(&vfs)?,
}))
}
}