diff options
author | HampusM <hampus@hampusmat.com> | 2025-08-09 12:37:46 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2025-08-09 13:50:46 +0200 |
commit | bb7c7d2f7d9bd9ad074c0186f5d503ee96b2f106 (patch) | |
tree | d58ed365764f320e3403c9ebd00f1b9d687217d5 /ecs/examples | |
parent | 2d1cf05abb72699d38a7c7db7e131922252e1fc1 (diff) |
fix(ecs): remove use of linkme to make pc-windows-gnu builds work
Linkme is broken on the x86_64-pc-windows-gnu
target (see https://github.com/dtolnay/linkme/issues/25)
so static entities are now called entity declarations and must be
created manually.
Diffstat (limited to 'ecs/examples')
-rw-r--r-- | ecs/examples/event_loop.rs | 12 | ||||
-rw-r--r-- | ecs/examples/with_sole.rs | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/ecs/examples/event_loop.rs b/ecs/examples/event_loop.rs index 61d7ba4..cc2f7f4 100644 --- a/ecs/examples/event_loop.rs +++ b/ecs/examples/event_loop.rs @@ -1,7 +1,7 @@ use ecs::actions::Actions; use ecs::pair::{ChildOf, Pair}; use ecs::phase::{Phase, UPDATE as UPDATE_PHASE}; -use ecs::{static_entity, Component, Query, World}; +use ecs::{declare_entity, Component, Query, World}; #[derive(Component)] struct Wool @@ -65,16 +65,20 @@ fn age(query: Query<(&mut Health, &Name)>, mut actions: Actions) } } -static_entity!(SHEER_PHASE, (Phase, Pair::new::<ChildOf>(*UPDATE_PHASE))); +declare_entity!(SHEER_PHASE, (Phase, Pair::new::<ChildOf>(*UPDATE_PHASE))); -static_entity!(FEED_PHASE, (Phase, Pair::new::<ChildOf>(*SHEER_PHASE))); +declare_entity!(FEED_PHASE, (Phase, Pair::new::<ChildOf>(*SHEER_PHASE))); -static_entity!(AGE_PHASE, (Phase, Pair::new::<ChildOf>(*FEED_PHASE))); +declare_entity!(AGE_PHASE, (Phase, Pair::new::<ChildOf>(*FEED_PHASE))); fn main() { let mut world = World::new(); + world.create_declared_entity(&SHEER_PHASE); + world.create_declared_entity(&FEED_PHASE); + world.create_declared_entity(&AGE_PHASE); + world.register_system(*SHEER_PHASE, sheer); world.register_system(*FEED_PHASE, feed); world.register_system(*AGE_PHASE, age); diff --git a/ecs/examples/with_sole.rs b/ecs/examples/with_sole.rs index c3feaab..a292f06 100644 --- a/ecs/examples/with_sole.rs +++ b/ecs/examples/with_sole.rs @@ -1,7 +1,7 @@ use ecs::pair::{ChildOf, Pair}; use ecs::phase::{Phase, UPDATE as UPDATE_PHASE}; use ecs::sole::Single; -use ecs::{static_entity, Component, Query, Sole, World}; +use ecs::{declare_entity, Component, Query, Sole, World}; #[derive(Component)] struct Ammo @@ -31,7 +31,7 @@ fn print_total_ammo_count(ammo_counter: Single<AmmoCounter>) assert_eq!(ammo_counter.counter, 19); } -static_entity!( +declare_entity!( PRINT_AMMO_COUNT_PHASE, (Phase, Pair::new::<ChildOf>(*UPDATE_PHASE)) ); @@ -40,6 +40,8 @@ fn main() { let mut world = World::new(); + world.create_declared_entity(&PRINT_AMMO_COUNT_PHASE); + world.register_system(*UPDATE_PHASE, count_ammo); world.register_system(*PRINT_AMMO_COUNT_PHASE, print_total_ammo_count); |