show the game version in the HUD

This commit is contained in:
yuni 2024-04-18 03:56:32 +02:00
parent 5d89043ef2
commit f169ceac8f
2 changed files with 9 additions and 1 deletions

View file

@ -204,9 +204,10 @@ fn setup(
}; };
// Add Statistics HUD // Add Statistics HUD
let version = &settings.version;
let mut bundle_fps = TextBundle::from_sections([ let mut bundle_fps = TextBundle::from_sections([
TextSection::new("", style.clone()), TextSection::new("", style.clone()),
TextSection::new(" ", style.clone()), TextSection::new(format!(" OutFlyOS v{version} "), style.clone()),
TextSection::new("", style.clone()), TextSection::new("", style.clone()),
TextSection::new("", style.clone()), TextSection::new("", style.clone()),
TextSection::new("", style.clone()), TextSection::new("", style.clone()),

View file

@ -18,6 +18,7 @@ pub const DEFAULT_CHAT_SPEED: f32 = 10.0;
pub struct Settings { pub struct Settings {
pub dev_mode: bool, pub dev_mode: bool,
pub god_mode: bool, pub god_mode: bool,
pub version: String,
pub mute_sfx: bool, pub mute_sfx: bool,
pub mute_music: bool, pub mute_music: bool,
pub volume_sfx: u8, pub volume_sfx: u8,
@ -110,10 +111,16 @@ impl Default for Settings {
default_mute_music = false; default_mute_music = false;
dev_mode = false; dev_mode = false;
} }
let version = if let Some(version) = option_env!("CARGO_PKG_VERSION") {
version.to_string()
} else {
"13.37".to_string()
};
Settings { Settings {
dev_mode, dev_mode,
god_mode: false, god_mode: false,
version,
mute_sfx: default_mute_sfx, mute_sfx: default_mute_sfx,
mute_music: default_mute_music, mute_music: default_mute_music,
volume_sfx: 100, volume_sfx: 100,