From b1c906e66f0e16d6a8bd0fbba88b89a289194b93 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Wed, 2 Dec 2020 16:28:51 +0100 Subject: [PATCH 1/5] Display fps and frame time in text_debug example --- examples/ui/text_debug.rs | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/examples/ui/text_debug.rs b/examples/ui/text_debug.rs index 856e934efd0a8..aed3ff774817b 100644 --- a/examples/ui/text_debug.rs +++ b/examples/ui/text_debug.rs @@ -1,10 +1,13 @@ -use bevy::prelude::*; -extern crate rand; +use bevy::{ + diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin}, + prelude::*, +}; /// This example is for debugging text layout fn main() { App::build() .add_plugins(DefaultPlugins) + .add_plugin(FrameTimeDiagnosticsPlugin) .add_startup_system(infotext_system) .add_system(change_text_system) .run(); @@ -83,7 +86,7 @@ fn infotext_system(commands: &mut Commands, asset_server: Res) { value: "This text changes in the bottom right".to_string(), font: font.clone(), style: TextStyle { - font_size: 50.0, + font_size: 30.0, color: Color::WHITE, alignment: TextAlignment::default(), }, @@ -120,11 +123,23 @@ fn infotext_system(commands: &mut Commands, asset_server: Res) { }); } -fn change_text_system(mut query: Query<(&mut Text, &TextChanges)>) { +fn change_text_system( + time: Res