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
mod dimension;
mod drawing_object;
mod layer;
mod name;
mod selected;
mod styles;
mod viewport;
mod vtable;
pub use dimension::Dimension;
pub use drawing_object::{DrawingObject, Geometry};
pub use layer::Layer;
pub use name::{Name, NameTable};
pub use selected::Selected;
pub use styles::{LineStyle, PointStyle, WindowStyle};
pub use viewport::Viewport;
pub(crate) use vtable::ComponentVtable;
use specs::World;
use crate::DrawingSpace;
pub(crate) fn known_components(
) -> impl Iterator<Item = &'static ComponentVtable> + 'static {
lazy_static::lazy_static! {
static ref VTABLES: Vec<ComponentVtable> = vec![
ComponentVtable::for_type::<arcs_core::BoundingBox<DrawingSpace>>(),
ComponentVtable::for_type::<DrawingObject>(),
ComponentVtable::for_type::<Layer>(),
ComponentVtable::for_type::<Name>(),
ComponentVtable::for_type::<LineStyle>(),
ComponentVtable::for_type::<PointStyle>(),
ComponentVtable::for_type::<Selected>(),
ComponentVtable::for_type::<WindowStyle>(),
ComponentVtable::for_type::<Viewport>(),
];
}
VTABLES.iter()
}
pub fn register(world: &mut World) {
log::debug!("Registering all components");
for component in known_components() {
log::debug!("Registering {}", component.name());
component.register(world);
}
}