summaryrefslogtreecommitdiff
path: root/ecs/examples/event_loop.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-10 19:51:46 +0200
committerHampusM <hampus@hampusmat.com>2024-04-10 19:51:46 +0200
commitc70e06c6d879208eb2822f6207ea7b29d47c2087 (patch)
tree06b5b7ae8fbf69d6041fff1c576d7610ff6fba6a /ecs/examples/event_loop.rs
parent9d8c73dd2671131929967214433dae5479e95b5b (diff)
chore(ecs): remove Event trait id method & take events by value
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 },