summaryrefslogtreecommitdiff
path: root/ecs/examples
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-08-07 20:07:46 +0200
committerHampusM <hampus@hampusmat.com>2024-08-07 20:07:46 +0200
commit127521d2ff42e0dd3a75ca44702256802303dd65 (patch)
tree5a5d100662567f92f177a97abdee4b57d2d50d2b /ecs/examples
parent3ea0d8cc96a54349aa064bb2fbf349b129e51c94 (diff)
docs(ecs): make examples not use own start event
Diffstat (limited to 'ecs/examples')
-rw-r--r--ecs/examples/multiple_queries.rs11
-rw-r--r--ecs/examples/relationship.rs11
-rw-r--r--ecs/examples/simple.rs11
3 files changed, 9 insertions, 24 deletions
diff --git a/ecs/examples/multiple_queries.rs b/ecs/examples/multiple_queries.rs
index 4bc12a3..d1fd3f1 100644
--- a/ecs/examples/multiple_queries.rs
+++ b/ecs/examples/multiple_queries.rs
@@ -1,6 +1,6 @@
use std::fmt::Display;
-use ecs::event::Event;
+use ecs::event::start::Start as StartEvent;
use ecs::{Component, Query, World};
#[derive(Component)]
@@ -57,16 +57,11 @@ fn do_attacks(
}
}
-#[derive(Debug, PartialEq, Eq, Hash)]
-struct Start;
-
-impl Event for Start {}
-
fn main()
{
let mut world = World::new();
- world.register_system(Start, do_attacks);
+ world.register_system(StartEvent, do_attacks);
world.create_entity((
Health { health: 100 },
@@ -88,5 +83,5 @@ fn main()
world.prepare();
- world.emit(Start);
+ world.emit(StartEvent);
}
diff --git a/ecs/examples/relationship.rs b/ecs/examples/relationship.rs
index 8610b47..ce39af6 100644
--- a/ecs/examples/relationship.rs
+++ b/ecs/examples/relationship.rs
@@ -1,4 +1,4 @@
-use ecs::event::Event;
+use ecs::event::start::Start as StartEvent;
use ecs::relationship::Relationship;
use ecs::{Component, Query, World};
@@ -30,16 +30,11 @@ fn print_player_stats(player_query: Query<(Player, Health, Relationship<Holding,
}
}
-#[derive(Debug)]
-struct Start;
-
-impl Event for Start {}
-
fn main()
{
let mut world = World::new();
- world.register_system(Start, print_player_stats);
+ world.register_system(StartEvent, print_player_stats);
let sword_uid = world.create_entity((Sword { attack_strength: 17 },));
@@ -51,5 +46,5 @@ fn main()
world.prepare();
- world.emit(Start);
+ world.emit(StartEvent);
}
diff --git a/ecs/examples/simple.rs b/ecs/examples/simple.rs
index 7212159..d29970d 100644
--- a/ecs/examples/simple.rs
+++ b/ecs/examples/simple.rs
@@ -1,4 +1,4 @@
-use ecs::event::Event;
+use ecs::event::start::Start as StartEvent;
use ecs::{Component, Query, World};
#[derive(Component)]
@@ -20,16 +20,11 @@ fn say_hello(query: Query<(SomeData, Greeting)>)
}
}
-#[derive(Debug)]
-struct Start;
-
-impl Event for Start {}
-
fn main()
{
let mut world = World::new();
- world.register_system(Start, say_hello);
+ world.register_system(StartEvent, say_hello);
world.create_entity((
SomeData { num: 987_654 },
@@ -45,5 +40,5 @@ fn main()
world.prepare();
- world.emit(Start);
+ world.emit(StartEvent);
}