4 releases
new 0.15.0 | Nov 30, 2024 |
---|---|
0.14.2 | Aug 6, 2024 |
0.14.1 | Aug 6, 2024 |
0.14.0 | Aug 6, 2024 |
#608 in Game dev
130 downloads per month
32KB
103 lines
bevy_debug_panel
add debug info to screen
Quickstart
simple show framerate example
use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin};
use bevy::prelude::*;
use bevy_debug_panel::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(DebugPanelPlugin)
.add_plugins(FrameTimeDiagnosticsPlugin)
.add_systems(Startup, setup)
.add_systems(Update, show_fps)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle { ..default() });
}
fn show_fps(diagnostics: Res<DiagnosticsStore>, mut debug_res: ResMut<DebugResource>) {
if let Some(value) = diagnostics
.get(&FrameTimeDiagnosticsPlugin::FPS)
.and_then(|fps| fps.smoothed())
{
debug_res.insert("Fps", format!("{:.2}", value));
}
}
compatible bevy versions
bevy | bevy_debug_panel |
---|---|
0.14 | 0.14 |
0.15 | 0.15 |
Dependencies
~53–86MB
~1.5M SLoC