create scaffolding
This commit is contained in:
commit
82a0fbdb50
25 changed files with 6993 additions and 0 deletions
40
crates/ui_debug/src/lib.rs
Normal file
40
crates/ui_debug/src/lib.rs
Normal 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),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue