From 8022e8998290b067b8aa0cb9cba8ba410826bdab Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 21 May 2026 17:55:20 +0200 Subject: chore: rename ecs* crates to engine-ecs* --- ecs/examples/relationship.rs | 56 -------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 ecs/examples/relationship.rs (limited to 'ecs/examples/relationship.rs') diff --git a/ecs/examples/relationship.rs b/ecs/examples/relationship.rs deleted file mode 100644 index 4e94151..0000000 --- a/ecs/examples/relationship.rs +++ /dev/null @@ -1,56 +0,0 @@ -use ecs::pair::{Pair, Wildcard}; -use ecs::phase::START as START_PHASE; -use ecs::{Component, Query, World}; - -#[derive(Component)] -struct Sword -{ - attack_strength: u32, -} - -#[derive(Component)] -struct Player; - -#[derive(Component)] -struct Health -{ - health: u32, -} - -#[derive(Component)] -struct Holding; - -fn print_player_stats(player_query: Query<(&Player, &Health, Pair)>) -{ - for (_, health, target_sword) in &player_query { - println!("Player health: {}", health.health); - - if let Some(sword_ent) = target_sword.get_target_ent() { - let sword = sword_ent - .get::() - .expect("Sword entity is missing sword component"); - - println!("Player sword attack strength: {}", sword.attack_strength); - } - } -} - -fn main() -{ - let mut world = World::new(); - - world.register_system(*START_PHASE, print_player_stats); - - let sword_uid = world.create_entity((Sword { attack_strength: 17 },)); - - world.create_entity(( - Player, - Health { health: 180 }, - Pair::builder() - .relation::() - .target_id(sword_uid) - .build(), - )); - - world.step(); -} -- cgit v1.2.3-18-g5258