From f169ceac8f1aa2026e54a60cf7fde450df9801f9 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 18 Apr 2024 03:56:32 +0200 Subject: [PATCH] show the game version in the HUD --- src/hud.rs | 3 ++- src/var.rs | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/hud.rs b/src/hud.rs index 23929d6..5eefec7 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -204,9 +204,10 @@ fn setup( }; // Add Statistics HUD + let version = &settings.version; let mut bundle_fps = TextBundle::from_sections([ 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()), diff --git a/src/var.rs b/src/var.rs index 34e665a..6c7534b 100644 --- a/src/var.rs +++ b/src/var.rs @@ -18,6 +18,7 @@ pub const DEFAULT_CHAT_SPEED: f32 = 10.0; pub struct Settings { pub dev_mode: bool, pub god_mode: bool, + pub version: String, pub mute_sfx: bool, pub mute_music: bool, pub volume_sfx: u8, @@ -110,10 +111,16 @@ impl Default for Settings { default_mute_music = false; dev_mode = false; } + let version = if let Some(version) = option_env!("CARGO_PKG_VERSION") { + version.to_string() + } else { + "13.37".to_string() + }; Settings { dev_mode, god_mode: false, + version, mute_sfx: default_mute_sfx, mute_music: default_mute_music, volume_sfx: 100,