From bacaeebcb6281b7718ca88d56ee0dbe1f00fe136 Mon Sep 17 00:00:00 2001 From: Arman Uguray Date: Sun, 5 Mar 2023 14:39:02 -0800 Subject: [PATCH] [frame_stats] Show viewport resolution on the stats layer Also set the stats layer toggle to be on by default until we add some UI to toggle it on mobile. --- examples/with_winit/src/lib.rs | 2 +- examples/with_winit/src/stats.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/with_winit/src/lib.rs b/examples/with_winit/src/lib.rs index e0281e2..76a1100 100644 --- a/examples/with_winit/src/lib.rs +++ b/examples/with_winit/src/lib.rs @@ -99,7 +99,7 @@ fn run( let mut simple_text = SimpleText::new(); let mut images = ImageCache::new(); let mut stats = stats::Stats::new(); - let mut stats_toggle = false; + let mut stats_toggle = true; let start = Instant::now(); let mut touch_state = multi_touch::TouchState::new(); diff --git a/examples/with_winit/src/stats.rs b/examples/with_winit/src/stats.rs index 9a3a1c9..344fc9e 100644 --- a/examples/with_winit/src/stats.rs +++ b/examples/with_winit/src/stats.rs @@ -79,6 +79,14 @@ impl Snapshot { offset * Affine::translate((left_margin, 3. * text_height)), &format!("Frame Time (max): {:.2} ms", self.frame_time_max_ms), ); + text.add( + sb, + None, + text_size, + Some(&Brush::Solid(Color::WHITE)), + offset * Affine::translate((left_margin, 4. * text_height)), + &format!("Resolution: {viewport_width}x{viewport_height}"), + ); text.add( sb, None,