From ee48b8382c0814975a9844397185e9f994247a28 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Fri, 22 Dec 2023 14:51:15 -0600 Subject: [PATCH] feat: show the game version at the bottom-right of the main menu. --- Cargo.lock | 21 +++++++++++++++++++++ Cargo.toml | 3 ++- src/ui/main_menu.rs | 16 ++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 4f6c851d0b..409a433283 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2232,6 +2232,26 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "git-version" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad568aa3db0fcbc81f2f116137f263d7304f512a1209b35b85150d3ef88ad19" +dependencies = [ + "git-version-macro", +] + +[[package]] +name = "git-version-macro" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.42", +] + [[package]] name = "glam" version = "0.24.2" @@ -2619,6 +2639,7 @@ dependencies = [ "bones_bevy_renderer", "bones_framework", "egui_extras", + "git-version", "humantime-serde", "indexmap 2.1.0", "nalgebra", diff --git a/Cargo.toml b/Cargo.toml index 7377e63d0b..5efa3dd8e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,9 +35,10 @@ serde_yaml = "0.9.25" thiserror = "1.0.48" peg = "0.8.1" egui_extras = { version = "0.23.0", default-features = false } +git-version = "0.3.9" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -bevy_dylib = "0.11" +bevy_dylib = "0.11" # anyhow = "1.0" # async-channel = "1.7" diff --git a/src/ui/main_menu.rs b/src/ui/main_menu.rs index 0eb705dc37..b0d05f1acb 100644 --- a/src/ui/main_menu.rs +++ b/src/ui/main_menu.rs @@ -88,6 +88,22 @@ fn main_menu_system(world: &World) { MenuPage::Credits => world.run_system(credits::widget, ui), MenuPage::NetworkGame => todo!(), }); + + egui::CentralPanel::default() + .frame(egui::Frame::none()) + .show(&ctx, |ui| { + ui.with_layout(egui::Layout::bottom_up(egui::Align::Max), |ui| { + ui.add_space(5.0); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Max), |ui| { + ui.add_space(5.0); + ui.add( + egui::TextEdit::singleline(&mut git_version::git_version!()) + .text_color(egui::Color32::WHITE) + .horizontal_align(egui::Align::Max), + ); + }) + }); + }); } /// System to render the home menu.