2020-04-05 21:12:14 +00:00
|
|
|
mod diagnostic;
|
2020-05-04 20:21:14 +00:00
|
|
|
mod frame_time_diagnostics_plugin;
|
2020-05-06 01:44:32 +00:00
|
|
|
mod print_diagnostics_plugin;
|
2020-06-28 07:45:35 +00:00
|
|
|
#[cfg(feature = "profiler")]
|
|
|
|
mod system_profiler;
|
2020-05-04 20:42:49 +00:00
|
|
|
pub use diagnostic::*;
|
2020-05-04 20:21:14 +00:00
|
|
|
pub use frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin;
|
2020-05-04 20:42:49 +00:00
|
|
|
pub use print_diagnostics_plugin::PrintDiagnosticsPlugin;
|
2020-03-27 22:03:47 +00:00
|
|
|
|
2020-07-17 01:47:51 +00:00
|
|
|
use bevy_app::prelude::*;
|
2020-05-04 18:43:21 +00:00
|
|
|
|
2020-05-04 20:42:49 +00:00
|
|
|
pub struct PrintDiagnostics {}
|
2020-03-27 22:03:47 +00:00
|
|
|
|
2020-05-04 20:42:49 +00:00
|
|
|
#[derive(Default)]
|
|
|
|
pub struct DiagnosticsPlugin;
|
2020-03-27 22:03:47 +00:00
|
|
|
|
2020-08-08 03:22:17 +00:00
|
|
|
impl Plugin for DiagnosticsPlugin {
|
2020-04-06 03:19:02 +00:00
|
|
|
fn build(&self, app: &mut AppBuilder) {
|
2020-05-01 20:12:47 +00:00
|
|
|
app.init_resource::<Diagnostics>();
|
2020-06-28 07:45:35 +00:00
|
|
|
#[cfg(feature = "profiler")]
|
|
|
|
{
|
2020-07-10 04:18:35 +00:00
|
|
|
use bevy_ecs::IntoQuerySystem;
|
2020-07-14 21:19:17 +00:00
|
|
|
app.add_resource::<Box<dyn bevy_ecs::profiler::Profiler>>(Box::new(
|
2020-07-10 04:18:35 +00:00
|
|
|
system_profiler::SystemProfiler::default(),
|
|
|
|
))
|
2020-07-14 21:19:17 +00:00
|
|
|
.add_system_to_stage(
|
2020-07-10 04:18:35 +00:00
|
|
|
bevy_app::stage::LAST,
|
|
|
|
system_profiler::profiler_diagnostic_system.system(),
|
|
|
|
);
|
2020-06-28 07:45:35 +00:00
|
|
|
}
|
2020-03-27 22:03:47 +00:00
|
|
|
}
|
2020-04-04 19:43:16 +00:00
|
|
|
}
|