Skip to content

Commit 97890b9

Browse files
authored
Merge pull request #7 from ASU-CodeDevils/feature/6/debug_plugin
Added Debug Plugin
2 parents 2555583 + db63587 commit 97890b9

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

game/src/debug.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod debug_plugin;

game/src/debug/debug_plugin.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use bevy::prelude::*;
2+
3+
///This plugin provides terminal debug capabilities
4+
///By adding systems, requested information will be printed to the terminal
5+
pub struct DebugPlugin;
6+
7+
///add the system(s) you wish to use to have debug info printed to terminal
8+
impl Plugin for DebugPlugin {
9+
fn build(&self, app: &mut App) {
10+
app.add_systems(Startup, print_debug_active_message);
11+
}
12+
}
13+
14+
///Function that verifies that the debugger is active by printing a single message to the terminal on startup
15+
///To use, add system using add_systems
16+
fn print_debug_active_message() {
17+
info!("The debugger is active!");
18+
}

game/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
mod debug;
12
mod movement;
23

34
use avian2d::prelude::*;
45
use bevy::prelude::*;
56
use bevy_ecs_ldtk::prelude::*;
7+
use debug::debug_plugin::DebugPlugin;
68
use movement::plugin::CharacterControllerPlugin;
79

810
fn main() {
@@ -11,5 +13,7 @@ fn main() {
1113
.add_plugins(PhysicsPlugins::default())
1214
.add_plugins(LdtkPlugin)
1315
.add_plugins(CharacterControllerPlugin)
16+
//user plugins
17+
.add_plugins(DebugPlugin)
1418
.run();
1519
}

0 commit comments

Comments
 (0)