diff options
author | HampusM <hampus@hampusmat.com> | 2024-12-09 14:05:33 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-12-09 14:05:33 +0100 |
commit | dcc40c9205e5f4cf484523f97eb12a561d7b2b22 (patch) | |
tree | 2908b6ca3b2fa390a45b383b91edf7a72c42ef4b /ecs/examples/with_local.rs | |
parent | 158e36bf6bfcbc2ed0ffc670788ed8c0abd3f282 (diff) |
refactor(ecs): use phases for system ordering
Diffstat (limited to 'ecs/examples/with_local.rs')
-rw-r--r-- | ecs/examples/with_local.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/ecs/examples/with_local.rs b/ecs/examples/with_local.rs index 5890b90..0872dfc 100644 --- a/ecs/examples/with_local.rs +++ b/ecs/examples/with_local.rs @@ -1,5 +1,5 @@ use ecs::component::local::Local; -use ecs::event::Event; +use ecs::phase::UPDATE as UPDATE_PHASE; use ecs::system::{Into, System}; use ecs::{Component, Query, World}; @@ -42,24 +42,19 @@ fn say_whats_up(query: Query<(SomeData, Name)>, mut state: Local<SayHelloState>) } } -#[derive(Debug)] -struct Update; - -impl Event for Update {} - fn main() { let mut world = World::new(); world.register_system( - Update, + *UPDATE_PHASE, say_hello .into_system() .initialize((SayHelloState { cnt: 0 },)), ); world.register_system( - Update, + *UPDATE_PHASE, say_whats_up .into_system() .initialize((SayHelloState { cnt: 0 },)), @@ -69,9 +64,6 @@ fn main() world.create_entity((SomeData { num: 345 },)); - world.emit(Update); - - println!("Haha"); - - world.emit(Update); + world.step(); + world.step(); } |