create scaffolding

This commit is contained in:
Jim 2025-08-24 09:42:18 -04:00
commit 82a0fbdb50
Signed by: jim
GPG key ID: 3236D2F059A7C0AC
25 changed files with 6993 additions and 0 deletions

View file

@ -0,0 +1,14 @@
[package]
name = "ui_debug"
version = "0.1.0"
edition = "2024"
[dependencies]
bevy = { workspace = true }
bevy-inspector-egui = { workspace = true }
input = { path = "../input" }
state = { path = "../state" }
[lints]
workspace = true

View file

@ -0,0 +1,40 @@
//bevy system signatures often violate these rules
#![allow(clippy::type_complexity)]
#![allow(clippy::too_many_arguments)]
use bevy::prelude::*;
use bevy_inspector_egui::quick::WorldInspectorPlugin;
use input::{actions::InputAction, conditions::action_just_pressed};
use state::GameSystemSet;
pub struct UiDebugPlugin;
impl Plugin for UiDebugPlugin {
fn build(&self, app: &mut App) {
app.init_state::<DebugUIState>()
.add_plugins(WorldInspectorPlugin::new().run_if(in_state(DebugUIState::Enabled)))
.add_systems(
Update,
toggle_debug_ui
.run_if(action_just_pressed::<Update>(InputAction::ToggleDebugUI))
.after(GameSystemSet::UpdateInputs),
);
}
}
#[derive(States, Default, Debug, Hash, PartialEq, Eq, Clone)]
pub enum DebugUIState {
#[default]
Disabled,
Enabled,
}
fn toggle_debug_ui(
mut next_state: ResMut<NextState<DebugUIState>>,
state: Res<State<DebugUIState>>,
) {
match state.get() {
DebugUIState::Disabled => next_state.set(DebugUIState::Enabled),
DebugUIState::Enabled => next_state.set(DebugUIState::Disabled),
}
}