| Crates.io | bevy_debug_panel |
| lib.rs | bevy_debug_panel |
| version | 0.16.0 |
| created_at | 2024-08-06 20:38:34.608229+00 |
| updated_at | 2025-05-08 15:11:11.937917+00 |
| description | show debug info to panel |
| homepage | |
| repository | https://github.com/alexniver/bevy_debug_panel |
| max_upload_size | |
| id | 1327699 |
| size | 131,575 |
add debug info to screen
simple show framerate example
use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin};
use bevy::prelude::*;
use bevy_debug_panel::prelude::*;
const MAX_HISTORY_LENGTH: usize = 16;
const SMOOTHING_FACTOR: f64 = 2.0 / (MAX_HISTORY_LENGTH + 1) as f64;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(DebugPanelPlugin)
.add_plugins(FrameTimeDiagnosticsPlugin {
max_history_length: MAX_HISTORY_LENGTH,
smoothing_factor: SMOOTHING_FACTOR,
})
.insert_resource(ClearColor(Color::srgb(0.5, 0.5, 0.9)))
.add_systems(Startup, setup)
.add_systems(Update, show_fps)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d);
}
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));
}
}
| bevy | bevy_debug_panel |
|---|---|
| 0.14 | 0.14 |
| 0.15 | 0.15 |