more compact hud

This commit is contained in:
yuni 2024-04-01 15:41:45 +02:00
parent 5e78f680de
commit f346624aff

View file

@ -129,7 +129,7 @@ fn setup(
};
let mut bundle_fps = TextBundle::from_sections([
TextSection::new(
"帧率 ",
"OutFly Augmented Reality 电量 ",
TextStyle {
font: asset_server.load(FONT),
font_size: settings.font_size_hud,
@ -147,7 +147,7 @@ fn setup(
}
),
TextSection::new(
"\n电量 ",
" 帧率 ",
TextStyle {
font: asset_server.load(FONT),
font_size: settings.font_size_hud,
@ -387,11 +387,11 @@ fn update(
if let Some(fps) = diagnostics.get(&FrameTimeDiagnosticsPlugin::FPS) {
if let Some(value) = fps.smoothed() {
// Update the value of the second section
text.sections[1].value = format!("{value:.0}");
text.sections[3].value = format!("{value:.0}");
}
}
let power = suit.power;
text.sections[3].value = format!("{power:}Wh");
let power = suit.power / suit.power_max * 100.0;
text.sections[1].value = format!("{power:}%");
let oxy_percent = suit.oxygen / suit.oxygen_max * 100.0;
let oxy_total = suit.oxygen * 1e6;