show version in menu

This commit is contained in:
yuni 2024-05-14 19:08:18 +02:00
parent a0dd6d45a0
commit 8f76a31cfa
2 changed files with 43 additions and 1 deletions

View file

@ -278,6 +278,44 @@ pub fn setup(
}, },
)); ));
}); });
let style_version = TextStyle {
font: font_handle.clone(),
font_size: settings.font_size_version,
color: settings.hud_color_version,
..default()
};
commands.spawn((
MenuElement,
NodeBundle {
style: Style {
width: Val::Percent(96.0),
height: Val::Percent(96.0),
left: Val::Percent(2.0),
top: Val::Percent(2.0),
align_items: AlignItems::End,
justify_content: JustifyContent::End,
..default()
},
visibility: Visibility::Hidden,
..default()
},
)).with_children(|builder| {
builder.spawn((
TextBundle {
text: Text {
sections: vec![
TextSection::new("OutFly ".to_string()
+ settings.version.as_str(), style_version),
],
justify: JustifyText::Right,
..default()
},
..default()
},
));
});
} }
pub fn show_deathscreen( pub fn show_deathscreen(

View file

@ -60,6 +60,7 @@ pub struct Settings {
pub font_size_achievement: f32, pub font_size_achievement: f32,
pub font_size_achievement_header: f32, pub font_size_achievement_header: f32,
pub font_size_keybindings: f32, pub font_size_keybindings: f32,
pub font_size_version: f32,
pub hud_color: Color, pub hud_color: Color,
pub hud_color_fps: Color, pub hud_color_fps: Color,
pub hud_color_console: Color, pub hud_color_console: Color,
@ -77,6 +78,7 @@ pub struct Settings {
pub hud_color_death: Color, pub hud_color_death: Color,
pub hud_color_death_achievements: Color, pub hud_color_death_achievements: Color,
pub hud_color_keybindings: Color, pub hud_color_keybindings: Color,
pub hud_color_version: Color,
pub chat_speed: f32, pub chat_speed: f32,
pub flashlight_active: bool, pub flashlight_active: bool,
pub hud_active: bool, pub hud_active: bool,
@ -154,7 +156,7 @@ impl Default for Settings {
let version = if let Some(version) = option_env!("CARGO_PKG_VERSION") { let version = if let Some(version) = option_env!("CARGO_PKG_VERSION") {
version.to_string() version.to_string()
} else { } else {
"13.37".to_string() "".to_string()
}; };
Settings { Settings {
@ -184,6 +186,7 @@ impl Default for Settings {
font_size_achievement: 24.0, font_size_achievement: 24.0,
font_size_achievement_header: 32.0, font_size_achievement_header: 32.0,
font_size_keybindings: 20.0, font_size_keybindings: 20.0,
font_size_version: 20.0,
hud_color: Color::hex("#BE1251").unwrap(), hud_color: Color::hex("#BE1251").unwrap(),
hud_color_fps: Color::hex("#181818").unwrap(), hud_color_fps: Color::hex("#181818").unwrap(),
hud_color_console: Color::hex("#BE1251").unwrap(), hud_color_console: Color::hex("#BE1251").unwrap(),
@ -201,6 +204,7 @@ impl Default for Settings {
hud_color_death: Color::hex("#CCCCCC").unwrap(), hud_color_death: Color::hex("#CCCCCC").unwrap(),
hud_color_death_achievements: Color::hex("#CCCCCC").unwrap(), hud_color_death_achievements: Color::hex("#CCCCCC").unwrap(),
hud_color_keybindings: Color::hex("#666666").unwrap(), hud_color_keybindings: Color::hex("#666666").unwrap(),
hud_color_version: Color::hex("#BE1251").unwrap(),
chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 }, chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 },
flashlight_active: false, flashlight_active: false,
hud_active: true, hud_active: true,