diff options
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, |
