-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make GalaxyDebugPlugin work onto on debug_assertions cfg flag fix a doc comment * cargo-bundle asset path set only when conditions are correct for it
- Loading branch information
Showing
2 changed files
with
17 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
use bevy::input::common_conditions::input_toggle_active; | ||
use bevy::{input::common_conditions::input_toggle_active, window::close_on_esc}; | ||
use bevy_inspector_egui::quick::{StateInspectorPlugin, WorldInspectorPlugin}; | ||
|
||
use crate::prelude::*; | ||
|
||
/// Backslash = KeyCode::Backslash | ||
/// | ||
/// Adds helpful features for debugging, like a [WorldInspectorPlugin] and | ||
/// [StateInspectorPlugin]. These can (by default) be toggled by pressing the | ||
/// Backslash (`\`) keycode. | ||
pub struct GalaxyDebugPlugin; | ||
|
||
impl Plugin for GalaxyDebugPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_plugin( | ||
WorldInspectorPlugin::default().run_if(input_toggle_active(true, KeyCode::Backslash)), | ||
) | ||
.add_plugin( | ||
StateInspectorPlugin::<EngineState>::default() | ||
.run_if(input_toggle_active(true, KeyCode::Backslash)), | ||
); | ||
if cfg!(debug_assertions) { | ||
app.add_plugin( | ||
WorldInspectorPlugin::default() | ||
.run_if(input_toggle_active(true, KeyCode::Backslash)), | ||
) | ||
.add_plugin( | ||
StateInspectorPlugin::<EngineState>::default() | ||
.run_if(input_toggle_active(true, KeyCode::Backslash)), | ||
); | ||
app.add_system(close_on_esc); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters