show git hash in game (#33)

This commit is contained in:
extrawurst
2025-04-19 11:13:19 +02:00
committed by GitHub
parent 0437f82957
commit 7cd4b38ebd
4 changed files with 117 additions and 0 deletions

View File

@@ -1,8 +1,11 @@
use bevy::prelude::*;
use bevy_debug_log::LogViewerVisibility;
pub const GIT_HASH: &str = env!("VERGEN_GIT_SHA");
pub fn plugin(app: &mut App) {
app.add_systems(Update, update);
app.add_systems(Startup, setup);
}
fn update(mut commands: Commands, keyboard: Res<ButtonInput<KeyCode>>) {
@@ -10,3 +13,21 @@ fn update(mut commands: Commands, keyboard: Res<ButtonInput<KeyCode>>) {
commands.trigger(LogViewerVisibility::Toggle);
}
}
fn setup(mut commands: Commands) {
commands.spawn((
Name::new("githash-ui"),
Text::new(GIT_HASH),
TextFont {
font_size: 12.0,
..default()
},
TextLayout::new_with_justify(JustifyText::Left),
Node {
position_type: PositionType::Absolute,
top: Val::Px(5.0),
left: Val::Px(5.0),
..default()
},
));
}