diff options
Diffstat (limited to 'ecs/src')
-rw-r--r-- | ecs/src/extension.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ecs/src/extension.rs b/ecs/src/extension.rs index e180ac7..9c6614b 100644 --- a/ecs/src/extension.rs +++ b/ecs/src/extension.rs @@ -1,6 +1,7 @@ use crate::component::Sequence as ComponentSequence; use crate::entity::Declaration as EntityDeclaration; use crate::sole::Sole; +use crate::system::observer::Observer; use crate::system::System; use crate::uid::Uid; use crate::{SoleAlreadyExistsError, World}; @@ -35,6 +36,15 @@ impl<'world> Collector<'world> self.world.register_system(phase_euid, system); } + /// Adds a observer system to the [`World`]. + pub fn add_observer<'this, SystemImpl>( + &'this mut self, + observer: impl Observer<'this, SystemImpl>, + ) + { + self.world.register_observer(observer); + } + /// Adds a entity to the [`World`]. pub fn add_entity<Comps>(&mut self, components: Comps) where |