diff options
author | HampusM <hampus@hampusmat.com> | 2024-06-08 20:47:35 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-06-15 16:32:24 +0200 |
commit | 69d90ece7f54996f0f51fc120a38d37717c5248e (patch) | |
tree | fe2de83e81648762778c1a77041293526c3db9d0 /ecs/src/system.rs | |
parent | bef61b765de52d14a52c3df86f8b3766846be272 (diff) |
perf(ecs): store components using archetypes
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 {} |