1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use entity::EntityData;
use component::ComponentManager;
use services::ServiceManager;
use world::DataHelper;
pub use system::entity::{EntityProcess, EntitySystem};
pub use system::interact::{InteractProcess, InteractSystem};
pub use system::interval::IntervalSystem;
pub use system::lazy::LazySystem;
pub mod entity;
pub mod interact;
pub mod interval;
pub mod lazy;
pub mod watcher;
pub trait System {
type Components: ComponentManager;
type Services: ServiceManager;
fn build_system() -> Self;
#[inline]
fn activated(
&mut self,
entity: EntityData<Self::Components>,
components: &Self::Components,
services: &mut Self::Services,
) {
let (_, _, _) = (entity, components, services);
}
#[inline]
fn reactivated(
&mut self,
entity: EntityData<Self::Components>,
components: &Self::Components,
services: &mut Self::Services,
) {
self.deactivated(entity, components, services);
self.activated(entity, components, services);
}
#[inline]
fn deactivated(
&mut self,
entity: EntityData<Self::Components>,
components: &Self::Components,
services: &mut Self::Services,
) {
let (_, _, _) = (entity, components, services);
}
}
pub trait Process: System {
fn process(&mut self, data: &mut DataHelper<Self::Components, Self::Services>);
}
pub trait SystemManager {
type Components: ComponentManager;
type Services: ServiceManager;
fn build_manager() -> Self;
fn activated(
&mut self,
entity: EntityData<Self::Components>,
components: &Self::Components,
services: &mut Self::Services,
);
fn reactivated(
&mut self,
entity: EntityData<Self::Components>,
components: &Self::Components,
services: &mut Self::Services,
);
fn deactivated(
&mut self,
entity: EntityData<Self::Components>,
components: &Self::Components,
services: &mut Self::Services,
);
fn update(&mut self, data: &mut DataHelper<Self::Components, Self::Services>);
#[doc(hidden)]
fn __please_use_the_derive_attribute();
}