show git hash in game (#33)
This commit is contained in:
21
src/debug.rs
21
src/debug.rs
@@ -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()
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user