From bb0e08fc359c175c724fa737ecf8bd91fb9a4f5b Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 17 Mar 2024 20:31:16 +0100 Subject: [PATCH] define font size in settings --- src/hud.rs | 7 +++---- src/settings.rs | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/hud.rs b/src/hud.rs index cc75117..4914cd9 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -12,7 +12,6 @@ impl Plugin for OutFlyHudPlugin { } const FONT: &str = "tmp/fonts/NotoSansSC-Thin.ttf"; -const FONT_SIZE: f32 = 50.0; #[derive(Component)] struct FpsText; @@ -32,10 +31,10 @@ fn setup( }; let mut bundle_fps = TextBundle::from_sections([ TextSection::new( - "帧率 ", + " 帧率 ", TextStyle { font: asset_server.load(FONT), - font_size: FONT_SIZE, + font_size: settings.font_size_hud, color: Color::GRAY, ..default() }, @@ -44,7 +43,7 @@ fn setup( "", TextStyle { font: asset_server.load(FONT), - font_size: FONT_SIZE, + font_size: settings.font_size_hud, color: Color::GRAY, ..default() } diff --git a/src/settings.rs b/src/settings.rs index b219f26..044614f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -6,6 +6,8 @@ pub struct Settings { pub mute_music: bool, pub volume_sfx: u8, pub volume_music: u8, + pub font_size_hud: f32, + pub font_size_conversations: f32, pub key_togglehud: KeyCode, pub ar_active: bool, } @@ -17,6 +19,8 @@ impl Default for Settings { mute_music: false, volume_sfx: 100, volume_music: 100, + font_size_hud: 32.0, + font_size_conversations: 32.0, key_togglehud: KeyCode::Tab, ar_active: true, }