Add FPS overlay to desktop_request_redraw test
This commit is contained in:
parent
1d3dee3744
commit
da40715bf1
@ -3639,6 +3639,7 @@ hidden = true
|
||||
name = "desktop_request_redraw"
|
||||
path = "tests/window/desktop_request_redraw.rs"
|
||||
doc-scrape-examples = true
|
||||
required-features = ["bevy_dev_tools"]
|
||||
|
||||
[package.metadata.example.desktop_request_redraw]
|
||||
hidden = true
|
||||
|
||||
@ -1,10 +1,32 @@
|
||||
//! Desktop request redraw
|
||||
use bevy::{prelude::*, window::RequestRedraw, winit::WinitSettings};
|
||||
use bevy::{
|
||||
dev_tools::fps_overlay::{FpsOverlayConfig, FpsOverlayPlugin},
|
||||
prelude::*,
|
||||
window::RequestRedraw,
|
||||
winit::WinitSettings,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_plugins(MeshPickingPlugin)
|
||||
// Enable the FPS overlay with a high resolution refresh interval. This makes it
|
||||
// easier to validate that UpdateMode is behaving correctly when desktop_app is used.
|
||||
// The FPS counter should essentially pause when the cube is not rotating and should
|
||||
// update rapidly when the cube is rotating or there is input (e.g. moving the mouse).
|
||||
//
|
||||
// Left and Right clicking the cube should roggle rotation on/off.
|
||||
.add_plugins(FpsOverlayPlugin {
|
||||
config: FpsOverlayConfig {
|
||||
text_config: TextFont {
|
||||
font_size: 12.0,
|
||||
..default()
|
||||
},
|
||||
text_color: Color::srgb(0.0, 1.0, 0.0),
|
||||
refresh_interval: core::time::Duration::from_millis(16),
|
||||
..default()
|
||||
},
|
||||
})
|
||||
.insert_resource(WinitSettings::desktop_app())
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, (update, redraw.after(update)))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user