Build dispatcher in systems.rs
This commit is contained in:
parent
763f4b7396
commit
2dc915d210
|
@ -5,7 +5,7 @@ use level::{DungeonLevel, LEVEL_SIZE};
|
||||||
use player::player_turn;
|
use player::player_turn;
|
||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
use systems::{DiscoverySystem, MobSystem, TimeSystem};
|
use systems::build_dispatcher;
|
||||||
|
|
||||||
mod components;
|
mod components;
|
||||||
mod io;
|
mod io;
|
||||||
|
@ -44,11 +44,7 @@ fn main() {
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mut dispatcher = DispatcherBuilder::new()
|
let mut dispatcher = build_dispatcher();
|
||||||
.with(TimeSystem, "time", &[])
|
|
||||||
.with(MobSystem, "mobs", &[])
|
|
||||||
.with(DiscoverySystem, "discovery", &[])
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let mut window = match init_window() {
|
let mut window = match init_window() {
|
||||||
Ok(window) => window,
|
Ok(window) => window,
|
||||||
|
|
|
@ -72,3 +72,12 @@ impl<'a> System<'a> for DiscoverySystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a Dispatcher with every system set up.
|
||||||
|
pub fn build_dispatcher() -> Dispatcher<'static, 'static> {
|
||||||
|
DispatcherBuilder::new()
|
||||||
|
.with(TimeSystem, "time", &[])
|
||||||
|
.with(MobSystem, "mobs", &[])
|
||||||
|
.with(DiscoverySystem, "discovery", &[])
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue