define font size in settings

This commit is contained in:
yuni 2024-03-17 20:31:16 +01:00
parent af4235c756
commit bb0e08fc35
2 changed files with 7 additions and 4 deletions

View file

@ -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()
}

View file

@ -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,
}