better display of coordinates

This commit is contained in:
yuni 2024-04-02 07:17:56 +02:00
parent 591db70d08
commit e49ff28640

View file

@ -164,6 +164,24 @@ fn setup(
..default() ..default()
} }
), ),
TextSection::new(
"\n木星中心 ",
TextStyle {
font: asset_server.load(FONT),
font_size: settings.font_size_hud,
color: Color::GRAY,
..default()
},
),
TextSection::new(
"",
TextStyle {
font: asset_server.load(FONT),
font_size: settings.font_size_hud,
color: Color::GRAY,
..default()
}
),
TextSection::new( TextSection::new(
"\n氧 OXYGEN ", "\n氧 OXYGEN ",
TextStyle { TextStyle {
@ -218,24 +236,6 @@ fn setup(
..default() ..default()
} }
), ),
TextSection::new(
"\n位置 ",
TextStyle {
font: asset_server.load(FONT),
font_size: settings.font_size_hud,
color: Color::GRAY,
..default()
},
),
TextSection::new(
"",
TextStyle {
font: asset_server.load(FONT),
font_size: settings.font_size_hud,
color: Color::GRAY,
..default()
}
),
TextSection::new( TextSection::new(
"\nSuit Integrity ", "\nSuit Integrity ",
TextStyle { TextStyle {
@ -416,17 +416,17 @@ fn update(
// the remaining oxygen hud info ignores leaking suits from low integrity // the remaining oxygen hud info ignores leaking suits from low integrity
if suit.oxygen > nature::OXY_H { if suit.oxygen > nature::OXY_H {
let oxy_hour = suit.oxygen / nature::OXY_H; let oxy_hour = suit.oxygen / nature::OXY_H;
text.sections[5].value = format!("{oxy_percent:.1}% [{oxy_total:.0}mg] [lasts {oxy_hour:.1} hours]"); text.sections[7].value = format!("{oxy_percent:.1}% [{oxy_total:.0}mg] [lasts {oxy_hour:.1} hours]");
} else { } else {
let oxy_min = suit.oxygen / nature::OXY_M; let oxy_min = suit.oxygen / nature::OXY_M;
text.sections[5].value = format!("{oxy_percent:.1}% [{oxy_total:.0}mg] [lasts {oxy_min:.1} min]"); text.sections[7].value = format!("{oxy_percent:.1}% [{oxy_total:.0}mg] [lasts {oxy_min:.1} min]");
} }
let adrenaline = lifeform.adrenaline * 990.0 + 10.0; let adrenaline = lifeform.adrenaline * 990.0 + 10.0;
text.sections[7].value = format!("{adrenaline:.0}pg/mL"); text.sections[9].value = format!("{adrenaline:.0}pg/mL");
let all_actors = query_all_actors.iter().len(); let all_actors = query_all_actors.iter().len();
text.sections[9].value = format!("{all_actors:.0}"); text.sections[11].value = format!("{all_actors:.0}");
let (x, y, z) = (pos.x, pos.y, pos.z); let (x, y, z) = (pos.x / 1.0e3, pos.y / 1.0e3, pos.z / 1.0e3);
text.sections[11].value = format!("{x:.0}|{z:.0}|{y:.0}"); text.sections[5].value = format!("{x:.0}km / {z:.0}km / {y:.0}km");
let integrity = suit.integrity * 100.0; let integrity = suit.integrity * 100.0;
text.sections[13].value = format!("{integrity:.0}%"); text.sections[13].value = format!("{integrity:.0}%");
let speed = cam_v.length(); let speed = cam_v.length();