diff options
| author | troido <troido@protonmail.com> | 2020-02-04 22:23:17 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-04 22:23:17 +0100 |
| commit | 323cd679cd29a8475c3b7486ce54ecd37620dbea (patch) | |
| tree | 1fc55c768a7b74644157c23580f54292e960c66a /src/room.rs | |
| parent | eb5997cbf94b1aa230cf4acb3008a7fe80ec36e0 (diff) | |
tried to implement deserialisation of entities
Diffstat (limited to 'src/room.rs')
| -rw-r--r-- | src/room.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/room.rs b/src/room.rs index 5eaee8e..4fcf658 100644 --- a/src/room.rs +++ b/src/room.rs @@ -28,6 +28,7 @@ use super::systems::{ controlinput::ControlInput, view::View }; +use super::compwrapper::CompWrapper; @@ -82,6 +83,14 @@ impl <'a, 'b>Room<'a, 'b> { pub fn add_obj(&mut self, template: &dyn Assemblage, (x, y): (i32, i32)) -> Entity { template.build(self.world.create_entity()).with(Position::new(Pos{x, y})).build() } + + pub fn add_complist(&mut self, template: &Vec<CompWrapper>, (x, y): (i32, i32)) -> Entity{ + let mut builder = self.world.create_entity(); + for comp in template { + builder = comp.build(builder); + } + builder.with(Position::new(Pos{x, y})).build() + } } |
