amico_core/world/
manager.rs1use crate::{ecs, traits::System};
2
3use super::{ActionSender, HandlerRegistry};
4
5#[derive(Debug)]
10pub struct WorldManager {
11 world: ecs::World,
12}
13
14impl WorldManager {
15 pub fn new() -> Self {
17 let world = ecs::World::new();
18
19 Self { world }
22 }
23
24 pub fn add_system<S: System>(&mut self, system: S) {
26 system.register_to(HandlerRegistry {
27 world: &mut self.world,
28 });
29 }
30
31 pub(crate) fn action_sender(&mut self) -> ActionSender {
33 ActionSender {
34 world: &mut self.world,
35 }
36 }
37}
38
39impl Default for WorldManager {
40 fn default() -> Self {
41 Self::new()
42 }
43}