diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 14:27:29 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 14:27:29 +0300 |
| commit | 71e342fd87b003642b669c062aa085926c9974aa (patch) | |
| tree | b3c54139e027720f225e67897570cb1df59c1269 /crates/fparkan-assets/src/game_font.rs | |
| parent | e2887b0d24a751632cc6e9cc7cc77b50b8a35149 (diff) | |
| download | fparkan-71e342fd87b003642b669c062aa085926c9974aa.tar.xz fparkan-71e342fd87b003642b669c062aa085926c9974aa.zip | |
feat(ui): show original tooltips on warbot card buttons
Diffstat (limited to 'crates/fparkan-assets/src/game_font.rs')
| -rw-r--r-- | crates/fparkan-assets/src/game_font.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/fparkan-assets/src/game_font.rs b/crates/fparkan-assets/src/game_font.rs index 12625e90..30eeda1b 100644 --- a/crates/fparkan-assets/src/game_font.rs +++ b/crates/fparkan-assets/src/game_font.rs @@ -17,6 +17,17 @@ pub fn load_layout_font(vfs: &dyn Vfs) -> Result<BitmapFont, String> { load_profile(vfs, 1, [640, 480], &["GAME_FONT"]).map(|[font]| font) } +/// The shipped sizes of the font used for tooltips. +pub const TOOL_FONT_EXTENTS: [[u32; 2]; 3] = [[640, 480], [800, 600], [1024, 768]]; + +/// Loads the original `TOOL_FONT` for one of the three screen profiles. +pub fn load_tool_font(vfs: &dyn Vfs, profile: usize) -> Result<BitmapFont, String> { + let extent = *TOOL_FONT_EXTENTS + .get(profile) + .ok_or("unknown tool font profile")?; + load_profile(vfs, (profile + 1) as u8, extent, &["TOOL_FONT"]).map(|[font]| font) +} + pub(crate) fn load_profile<const N: usize>( vfs: &dyn Vfs, profile: u8, |
