diff --git a/src/components/mod.rs b/src/components/mod.rs index 531c414..b7909d3 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -1,2 +1,4 @@ +use crate::prelude::*; + pub struct Name(pub String); pub struct Player; diff --git a/src/main.rs b/src/main.rs index 6d78ab0..867a28e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,19 @@ mod components; +mod plugins; mod systems; -use bevy::prelude::*; -use systems::*; +mod prelude { + pub use crate::components::*; + pub use crate::plugins::*; + pub use crate::systems::*; + pub use bevy::prelude::*; +} + +use prelude::*; fn main() { App::build() - .add_startup_system(add_player.system()) - .add_system(greet_player.system()) + .add_plugins(DefaultPlugins) + .add_plugin(PlayerPlugin) .run(); } diff --git a/src/plugins/mod.rs b/src/plugins/mod.rs new file mode 100644 index 0000000..56a56d0 --- /dev/null +++ b/src/plugins/mod.rs @@ -0,0 +1,10 @@ +use crate::prelude::*; + +pub struct PlayerPlugin; + +impl Plugin for PlayerPlugin { + fn build(&self, app: &mut AppBuilder) { + app.add_startup_system(add_player.system()) + .add_system(greet_player.system()); + } +} diff --git a/src/systems/mod.rs b/src/systems/mod.rs index 2ce9f5c..f067ea3 100644 --- a/src/systems/mod.rs +++ b/src/systems/mod.rs @@ -1,5 +1,4 @@ -use crate::components::{Name, Player}; -use bevy::prelude::*; +use crate::prelude::*; pub fn add_player(mut commands: Commands) { commands