changed diagnostics from seconds to milliseconds (#5554)

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>

# Objective

Change frametimediagnostic from seconds to milliseconds because this will always be less than one seconds and is the common diagnostic display unit for game engines.

## Solution

- multiplied the existing value by 1000

---

## Changelog

Frametimes are now reported in milliseconds

Co-authored-by: Syama Mishra <38512086+SyamaMishra@users.noreply.github.com>
Co-authored-by: McSpidey <mcspidey@gmail.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
This commit is contained in:
McSpidey 2022-08-04 22:27:14 +00:00
parent 90d1dc8820
commit 0ffb5441c3
2 changed files with 4 additions and 5 deletions

View File

@ -27,7 +27,7 @@ impl FrameTimeDiagnosticsPlugin {
DiagnosticId::from_u128(73441630925388532774622109383099159699);
pub fn setup_system(mut diagnostics: ResMut<Diagnostics>) {
diagnostics.add(Diagnostic::new(Self::FRAME_TIME, "frame_time", 20).with_suffix("s"));
diagnostics.add(Diagnostic::new(Self::FRAME_TIME, "frame_time", 20).with_suffix("ms"));
diagnostics.add(Diagnostic::new(Self::FPS, "fps", 20));
diagnostics.add(Diagnostic::new(Self::FRAME_COUNT, "frame_count", 1));
}
@ -46,7 +46,7 @@ impl FrameTimeDiagnosticsPlugin {
return;
}
diagnostics.add_measurement(Self::FRAME_TIME, || time.delta_seconds_f64());
diagnostics.add_measurement(Self::FRAME_TIME, || time.delta_seconds_f64() * 1000.);
diagnostics.add_measurement(Self::FPS, || 1.0 / time.delta_seconds_f64());
}

View File

@ -176,12 +176,11 @@ fn change_text_system(
text.sections[0].value = format!(
"This text changes in the bottom right - {:.1} fps, {:.3} ms/frame",
fps,
frame_time * 1000.0,
fps, frame_time,
);
text.sections[2].value = format!("{:.1}", fps);
text.sections[4].value = format!("{:.3}", frame_time * 1000.0);
text.sections[4].value = format!("{:.3}", frame_time);
}
}