-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathspecific_entries.rs
59 lines (52 loc) · 2.1 KB
/
specific_entries.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! This example shows the simplest way to create a Perf UI with specific entries.
//! (using defaults for everything)
use bevy::prelude::*;
use iyes_perf_ui::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
// we want Bevy to measure these values for us:
.add_plugins(bevy::diagnostic::FrameTimeDiagnosticsPlugin)
.add_plugins(bevy::diagnostic::EntityCountDiagnosticsPlugin)
.add_plugins(bevy::diagnostic::SystemInformationDiagnosticsPlugin)
.add_plugins(PerfUiPlugin)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
// spawn a camera to be able to see anything
commands.spawn(Camera2d);
// Customize your Perf UI by explicitly listing the entries you want.
commands.spawn((
PerfUiRoot {
// set a fixed width to make all the bars line up
values_col_width: Some(160.0),
..Default::default()
},
// when we have lots of entries, we have to group them
// into tuples, because of Bevy Rust syntax limitations
(
PerfUiWidgetBar::new(PerfUiEntryFPS::default()),
PerfUiWidgetBar::new(PerfUiEntryFPSWorst::default()),
PerfUiWidgetBar::new(PerfUiEntryFrameTime::default()),
PerfUiWidgetBar::new(PerfUiEntryFrameTimeWorst::default()),
PerfUiWidgetBar::new(PerfUiEntryEntityCount::default()),
PerfUiWidgetBar::new(PerfUiEntryCpuUsage::default()),
PerfUiWidgetBar::new(PerfUiEntryMemUsage::default()),
PerfUiEntryFrameCount::default(),
),
(
PerfUiEntryFixedTimeStep::default(),
PerfUiWidgetBar::new(PerfUiEntryFixedOverstep::default()),
PerfUiEntryRunningTime::default(),
PerfUiEntryClock::default(),
),
(
PerfUiEntryCursorPosition::default(),
PerfUiEntryWindowResolution::default(),
PerfUiEntryWindowScaleFactor::default(),
PerfUiEntryWindowMode::default(),
PerfUiEntryWindowPresentMode::default(),
),
));
}