diff options
Diffstat (limited to 'ecs/examples/with_single.rs')
-rw-r--r-- | ecs/examples/with_single.rs | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/ecs/examples/with_single.rs b/ecs/examples/with_single.rs index 25b73d1..d222f76 100644 --- a/ecs/examples/with_single.rs +++ b/ecs/examples/with_single.rs @@ -1,5 +1,5 @@ use ecs::component::single::Single; -use ecs::event::{Event, Id as EventId}; +use ecs::event::Event; use ecs::{Component, Query, World}; #[derive(Component)] @@ -33,31 +33,19 @@ fn print_total_ammo_count(ammo_counter: Single<AmmoCounter>) #[derive(Debug)] struct EventA; -impl Event for EventA -{ - fn id(&self) -> EventId - { - EventId::of::<Self>() - } -} +impl Event for EventA {} #[derive(Debug)] struct EventB; -impl Event for EventB -{ - fn id(&self) -> EventId - { - EventId::of::<Self>() - } -} +impl Event for EventB {} fn main() { let mut world = World::new(); - world.register_system(&EventA, count_ammo); - world.register_system(&EventB, print_total_ammo_count); + world.register_system(EventA, count_ammo); + world.register_system(EventB, print_total_ammo_count); world.create_entity((Ammo { ammo_left: 4 },)); world.create_entity((Ammo { ammo_left: 7 },)); @@ -65,7 +53,7 @@ fn main() world.add_single_component(AmmoCounter::default()).unwrap(); - world.emit(&EventA); + world.emit(EventA); - world.emit(&EventB); + world.emit(EventB); } |