|
|
|
|
@ -6,14 +6,16 @@ use super::*;
|
|
|
|
|
pub struct DebugPlugin;
|
|
|
|
|
|
|
|
|
|
// Debugging wish-list:
|
|
|
|
|
// - Toggle debug on/off with f12 key
|
|
|
|
|
// - Bounding boxes around entities
|
|
|
|
|
// - Toggleable in UI
|
|
|
|
|
// - Cursor at the center of the world
|
|
|
|
|
// - Show current state(s)
|
|
|
|
|
// - Toggleable in UI
|
|
|
|
|
// - Show current state(s) in UI
|
|
|
|
|
impl Plugin for DebugPlugin {
|
|
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
|
app
|
|
|
|
|
.init_state::<Debugger>()
|
|
|
|
|
.add_systems(Startup, setup_ui)
|
|
|
|
|
.add_systems(Update,
|
|
|
|
|
// Logging state transitions
|
|
|
|
|
(
|
|
|
|
|
@ -33,6 +35,15 @@ pub enum Debugger {
|
|
|
|
|
On,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Setup the debugger UI
|
|
|
|
|
fn setup_ui(
|
|
|
|
|
mut commands: Commands,
|
|
|
|
|
) {
|
|
|
|
|
commands.spawn(
|
|
|
|
|
(toggle_switch((),), observe(checkbox_self_update)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Logs all state transitions for state T
|
|
|
|
|
fn log_transition<T: States + PartialEq + Clone>(
|
|
|
|
|
curr: Res<State<T>>,
|
|
|
|
|
|