From c70e06c6d879208eb2822f6207ea7b29d47c2087 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 10 Apr 2024 19:51:46 +0200 Subject: chore(ecs): remove Event trait id method & take events by value --- ecs/examples/event_loop.rs | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'ecs/examples/event_loop.rs') diff --git a/ecs/examples/event_loop.rs b/ecs/examples/event_loop.rs index b6a10e3..8d8d84f 100644 --- a/ecs/examples/event_loop.rs +++ b/ecs/examples/event_loop.rs @@ -1,5 +1,5 @@ use ecs::actions::Actions; -use ecs::event::{Event, Id as EventId}; +use ecs::event::Event; use ecs::{Component, Query, World}; #[derive(Component)] @@ -67,43 +67,25 @@ fn age(query: Query<(Health, Name)>, mut actions: Actions) #[derive(Debug)] struct EventA; -impl Event for EventA -{ - fn id(&self) -> EventId - { - EventId::of::() - } -} +impl Event for EventA {} #[derive(Debug)] struct EventB; -impl Event for EventB -{ - fn id(&self) -> EventId - { - EventId::of::() - } -} +impl Event for EventB {} #[derive(Debug)] struct EventC; -impl Event for EventC -{ - fn id(&self) -> EventId - { - EventId::of::() - } -} +impl Event for EventC {} fn main() { let mut world = World::new(); - world.register_system(&EventA, sheer); - world.register_system(&EventB, feed); - world.register_system(&EventC, age); + world.register_system(EventA, sheer); + world.register_system(EventB, feed); + world.register_system(EventC, age); world.create_entity(( Wool { remaining: 30 }, -- cgit v1.2.3-18-g5258