|
|
|
@ -31,7 +31,6 @@ impl Plugin for DebugPlugin {
|
|
|
|
toggle_debug_mode.run_if(on_event::<KeyboardInput>()),
|
|
|
|
toggle_debug_mode.run_if(on_event::<KeyboardInput>()),
|
|
|
|
display_diagnostics.run_if(resource_exists::<DebugEnabled>),
|
|
|
|
display_diagnostics.run_if(resource_exists::<DebugEnabled>),
|
|
|
|
toggle_debug_ui.run_if(resource_changed_or_removed::<DebugEnabled>()),
|
|
|
|
toggle_debug_ui.run_if(resource_changed_or_removed::<DebugEnabled>()),
|
|
|
|
camera_info.run_if(resource_exists::<DebugEnabled>),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -128,7 +127,13 @@ fn display_diagnostics(
|
|
|
|
root.iter_mut().for_each(|mut text| {
|
|
|
|
root.iter_mut().for_each(|mut text| {
|
|
|
|
text.sections = diagnostics
|
|
|
|
text.sections = diagnostics
|
|
|
|
.iter()
|
|
|
|
.iter()
|
|
|
|
.map(|d| format!("{}: {:.0}\n", d.suffix, d.smoothed().unwrap_or(0.0),))
|
|
|
|
.map(|d| {
|
|
|
|
|
|
|
|
format!(
|
|
|
|
|
|
|
|
"{}: {:.0}\n",
|
|
|
|
|
|
|
|
d.path().as_str(),
|
|
|
|
|
|
|
|
d.smoothed().unwrap_or(0.0),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
})
|
|
|
|
.chain(debug_infos.iter().map(|(k, v)| format!("{}: {}\n", k, v)))
|
|
|
|
.chain(debug_infos.iter().map(|(k, v)| format!("{}: {}\n", k, v)))
|
|
|
|
.map(|s| TextSection::new(s, TextStyle { ..default() }))
|
|
|
|
.map(|s| TextSection::new(s, TextStyle { ..default() }))
|
|
|
|
.collect();
|
|
|
|
.collect();
|
|
|
|
@ -136,19 +141,6 @@ fn display_diagnostics(
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn camera_info(mut debug_infos: ResMut<DebugInfo>, cameras: Query<(&Camera, &Name)>) {
|
|
|
|
|
|
|
|
let camera_names = cameras
|
|
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
|
|
.filter(|(c, _)| c.is_active)
|
|
|
|
|
|
|
|
.map(|(_, n)| n.as_str())
|
|
|
|
|
|
|
|
.collect::<Vec<&str>>()
|
|
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
|
|
.copied()
|
|
|
|
|
|
|
|
.intersperse(", ")
|
|
|
|
|
|
|
|
.collect::<String>();
|
|
|
|
|
|
|
|
debug_infos.set("Cameras".into(), camera_names);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn aabb_gizmo(
|
|
|
|
fn aabb_gizmo(
|
|
|
|
added: Query<Entity, Added<game::Selected>>,
|
|
|
|
added: Query<Entity, Added<game::Selected>>,
|
|
|
|
mut removed: RemovedComponents<game::Selected>,
|
|
|
|
mut removed: RemovedComponents<game::Selected>,
|
|
|
|
|