odyssey-server/src/game/world.rs

21 lines
373 B
Rust

use specs::prelude::*;
use super::components::transform::Transform;
pub struct GameWorld {
pub world: World,
}
impl GameWorld {
pub fn new() -> Self {
let mut world = World::new();
world.register::<Transform>();
GameWorld { world }
}
pub fn dispatcher(self) -> specs::AsyncDispatcher<'static, World> {
DispatcherBuilder::new().build_async(self.world)
}
}