diff options
| author | HampusM <hampus@hampusmat.com> | 2026-07-10 13:31:46 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-07-10 13:41:00 +0200 |
| commit | f6b86d55f27c43b239346c6bce1d360b257a2d19 (patch) | |
| tree | 1a09bee83554e0728573bb5cc6a0197c9b83a426 /engine-ecs/src/phase.rs | |
| parent | e7fa00a81d158f17736d1a66c1bd4b304969f3e5 (diff) | |
feat(engine-ecs): add INIT phase
Diffstat (limited to 'engine-ecs/src/phase.rs')
| -rw-r--r-- | engine-ecs/src/phase.rs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/engine-ecs/src/phase.rs b/engine-ecs/src/phase.rs index cb87cc6..f789120 100644 --- a/engine-ecs/src/phase.rs +++ b/engine-ecs/src/phase.rs @@ -3,13 +3,27 @@ use crate::{declare_entity, Component, World}; #[derive(Debug, Default, Clone, Copy, Component)] pub struct Phase; -declare_entity!(pub START, (Phase,)); -declare_entity!(pub PRE_UPDATE, (Phase,)); -declare_entity!(pub UPDATE, (Phase,)); -declare_entity!(pub POST_UPDATE, (Phase,)); +declare_entity! { +/// Initialization phase that only occurs the first tick, before [`START`]. +/// Should not be used for game logic +pub INIT: (Phase,); -pub(crate) fn spawn_entities(world: &mut World) +/// Phase that only occurs the first tick, after [`INIT`]. +pub START: (Phase,); + +/// Phase that occurs every tick, before [`UPDATE`]. +pub PRE_UPDATE: (Phase,); + +/// Phase that occurs every tick, after [`PRE_UPDATE`]. +pub UPDATE: (Phase,); + +/// Phase that occurs every tick, after [`UPDATE`]. +pub POST_UPDATE: (Phase,); +} + +pub(crate) fn spawn_standard_phases(world: &mut World) { + world.spawn_declared_entity(&INIT); world.spawn_declared_entity(&START); world.spawn_declared_entity(&PRE_UPDATE); world.spawn_declared_entity(&UPDATE); |
