From a4dee10487b28d7a610ec10d5cba1bffb77b10b9 Mon Sep 17 00:00:00 2001 From: Danny McGee Date: Thu, 28 Sep 2023 15:48:50 -0400 Subject: [PATCH] Move framerate counter to UI layer --- hello-world/src/main.rs | 22 ++++++++---------- hello-world/src/ui.rs | 50 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 hello-world/src/ui.rs diff --git a/hello-world/src/main.rs b/hello-world/src/main.rs index 4de4692..492f052 100644 --- a/hello-world/src/main.rs +++ b/hello-world/src/main.rs @@ -4,23 +4,24 @@ use bevy::prelude::*; mod orbit_cam; mod test_scene; +mod ui; use orbit_cam::{OrbitCam, OrbitCamPlugin}; use test_scene::TestScenePlugin; +use ui::UiLayerPlugin; fn main() { #[cfg(target_arch = "wasm32")] console_error_panic_hook::set_once(); App::new() - .add_plugins((DefaultPlugins, OrbitCamPlugin, TestScenePlugin)) - .add_systems( - Update, - ( - draw_world_axes.after(orbit_cam::pan_orbit_camera), - report_framerate, - ), - ) + .add_plugins(( + DefaultPlugins, + OrbitCamPlugin, + TestScenePlugin, + UiLayerPlugin, + )) + .add_systems(Update, draw_world_axes.after(orbit_cam::pan_orbit_camera)) .run(); } @@ -36,8 +37,3 @@ fn draw_world_axes(mut gizmos: Gizmos, q: Query<&OrbitCam>) { draw_axis(Vec3::Y, Color::GREEN); draw_axis(Vec3::Z, Color::BLUE); } - -fn report_framerate(time: Res