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/component_removed_event.rs | 46 --------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 ecs/examples/component_removed_event.rs (limited to 'ecs/examples/component_removed_event.rs') diff --git a/ecs/examples/component_removed_event.rs b/ecs/examples/component_removed_event.rs deleted file mode 100644 index 9b73b1a..0000000 --- a/ecs/examples/component_removed_event.rs +++ /dev/null @@ -1,46 +0,0 @@ -use ecs::actions::Actions; -use ecs::component::Component; -use ecs::event::component::{EventMatchExt, Removed}; -use ecs::pair::Pair; -use ecs::phase::UPDATE; -use ecs::system::observer::Observe; -use ecs::{Component, Query, World}; - -#[derive(Debug, Component)] -struct Cheese -{ - name: &'static str, -} - -fn eat_cheese(query: Query<(&Cheese,)>, mut actions: Actions) -{ - for (cheese_ent_id, (_,)) in query.iter_with_euids() { - println!("Eating cheese!"); - - actions.remove_components(cheese_ent_id, [Cheese::id()]); - } -} - -fn on_cheese_removed(observe: Observe>) -{ - for evt_match in &observe { - let cheese = evt_match.get_ent_target_comp(); - - println!("{} cheese was eaten", cheese.name); - } -} - -fn main() -{ - let mut world = World::new(); - - world.register_system(*UPDATE, eat_cheese); - world.register_observer(on_cheese_removed); - - world.create_entity((Cheese { name: "Brie" },)); - world.create_entity((Cheese { name: "Parmesan" },)); - world.create_entity((Cheese { name: "Gouda" },)); - - world.step(); - world.step(); -} -- cgit v1.2.3-18-g5258