File tree 2 files changed +21
-7
lines changed
2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change
1
+ use bevy:: diagnostic:: { DiagnosticsStore , FrameTimeDiagnosticsPlugin } ;
1
2
use bevy:: ecs:: system:: SystemParam ;
2
3
use bevy:: prelude:: * ;
3
4
use bevy_file_dialog:: prelude:: * ;
@@ -122,6 +123,7 @@ pub fn draw_egui(
122
123
sim_time : Res < SimTime > ,
123
124
time : Res < Time > ,
124
125
mut fixed_timestep : ResMut < Time < Fixed > > ,
126
+ diagnostics : Res < DiagnosticsStore > ,
125
127
) {
126
128
let QuerySystemParams {
127
129
mut rect_wall_set,
@@ -1178,11 +1180,21 @@ pub fn draw_egui(
1178
1180
} ) ;
1179
1181
1180
1182
ui. add_space ( 5. ) ;
1181
- ui. label ( format ! (
1182
- "Simulation Time: {:.5} ms" ,
1183
- sim_time. time_since_start * 1000.
1184
- ) ) ;
1185
-
1183
+ ui. horizontal ( |ui| {
1184
+ ui. label ( format ! (
1185
+ "Simulation Time: {:.5} ms" ,
1186
+ sim_time. time_since_start * 1000.
1187
+ ) ) ;
1188
+
1189
+ ui. add ( egui:: Separator :: default ( ) . vertical ( ) ) ;
1190
+ ui. label ( format ! (
1191
+ "FPS: {:.1} ms" ,
1192
+ diagnostics
1193
+ . get( & FrameTimeDiagnosticsPlugin :: FPS )
1194
+ . and_then( |fps| fps. smoothed( ) )
1195
+ . unwrap_or( 0.0 )
1196
+ ) ) ;
1197
+ } ) ;
1186
1198
ui. add_space ( 5. ) ;
1187
1199
} ) ;
1188
1200
Original file line number Diff line number Diff line change
1
+ use bevy:: diagnostic:: FrameTimeDiagnosticsPlugin ;
1
2
use bevy:: prelude:: * ;
2
3
use bevy_file_dialog:: FileDialogPlugin ;
3
4
@@ -14,11 +15,12 @@ impl Plugin for UiPlugin {
14
15
. init_resource :: < ClipboardBuffer > ( )
15
16
. init_resource :: < DockState > ( )
16
17
. init_resource :: < FftMicrophone > ( )
17
- . add_plugins (
18
+ . add_plugins ( (
18
19
FileDialogPlugin :: new ( )
19
20
. with_save_file :: < SaveFileContents > ( )
20
21
. with_load_file :: < SaveFileContents > ( ) ,
21
- )
22
+ FrameTimeDiagnosticsPlugin ,
23
+ ) )
22
24
. add_systems ( Update , ( draw_egui, file_loaded) ) ;
23
25
}
24
26
}
You can’t perform that action at this time.
0 commit comments