use specs::{Dispatcher as Inner, DispatcherBuilder, World}; use crate::{ resources::Global, systems::{Movement, Process}, }; pub struct Dispatcher<'a, 'b> { dispatcher: Inner<'a, 'b>, } impl<'a, 'b> Dispatcher<'a, 'b> { pub fn new(world: &mut World) -> Self { world.insert(Global::default()); let mut dispatcher = DispatcherBuilder::new() .with(Process::default(), "process", &[]) .with(Movement::default(), "movement", &[]) .build(); dispatcher.setup(world); Self { dispatcher } } pub fn process(&mut self, world: &World) { self.dispatcher.dispatch(world); } }