diff options
Diffstat (limited to 'ecs/src/system.rs')
-rw-r--r-- | ecs/src/system.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ecs/src/system.rs b/ecs/src/system.rs index 47872a6..868afa7 100644 --- a/ecs/src/system.rs +++ b/ecs/src/system.rs @@ -25,6 +25,8 @@ pub trait System<'world, Impl>: 'static #[must_use] fn initialize(self, input: Self::Input) -> Self; + fn prepare(&self, world_data: &WorldData); + fn run<'this>(&'this self, world_data: &'world WorldData) where 'this: 'world; @@ -57,6 +59,13 @@ macro_rules! impl_system { self } + fn prepare(&self, world_data: &WorldData) + { + #( + TParam~I::handle_pre_run(world_data); + )* + } + fn run<'this>(&'this self, world_data: &'world WorldData) where 'this: 'world @@ -179,6 +188,8 @@ pub unsafe trait Param<'world> fn is_compatible<Other: Param<'world>>() -> bool; fn get_comparable() -> Box<dyn Any>; + + fn handle_pre_run(_world_data: &WorldData) {} } pub struct NoInitParamFlag {} |