21 lines
376 B
Rust
21 lines
376 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)
|
|
}
|
|
}
|