bevy/crates/bevy_diagnostic/src/lib.rs
Victor "multun" Collod 1ec7183494 profiling: fix build
2020-08-16 02:06:59 -07:00

31 lines
939 B
Rust

mod diagnostic;
mod frame_time_diagnostics_plugin;
mod print_diagnostics_plugin;
#[cfg(feature = "profiler")]
mod system_profiler;
pub use diagnostic::*;
pub use frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin;
pub use print_diagnostics_plugin::PrintDiagnosticsPlugin;
use bevy_app::prelude::*;
/// Adds core diagnostics resources to an App.
#[derive(Default)]
pub struct DiagnosticsPlugin;
impl Plugin for DiagnosticsPlugin {
fn build(&self, app: &mut AppBuilder) {
app.init_resource::<Diagnostics>();
#[cfg(feature = "profiler")]
{
use bevy_ecs::IntoQuerySystem;
app.add_resource::<Box<dyn bevy_ecs::Profiler>>(Box::new(
system_profiler::SystemProfiler::default(),
))
.add_system_to_stage(
bevy_app::stage::LAST,
system_profiler::profiler_diagnostic_system.system(),
);
}
}
}