summaryrefslogtreecommitdiff
path: root/ecs/examples/event_loop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/examples/event_loop.rs')
-rw-r--r--ecs/examples/event_loop.rs32
1 files changed, 7 insertions, 25 deletions
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::<Self>()
- }
-}
+impl Event for EventA {}
#[derive(Debug)]
struct EventB;
-impl Event for EventB
-{
- fn id(&self) -> EventId
- {
- EventId::of::<Self>()
- }
-}
+impl Event for EventB {}
#[derive(Debug)]
struct EventC;
-impl Event for EventC
-{
- fn id(&self) -> EventId
- {
- EventId::of::<Self>()
- }
-}
+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 },