summaryrefslogtreecommitdiff
path: root/engine-ecs/examples
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/examples')
-rw-r--r--engine-ecs/examples/component_changed_event.rs4
-rw-r--r--engine-ecs/examples/component_events.rs6
-rw-r--r--engine-ecs/examples/component_relationship.rs6
-rw-r--r--engine-ecs/examples/component_removed_event.rs6
-rw-r--r--engine-ecs/examples/error_handling.rs2
-rw-r--r--engine-ecs/examples/event_loop.rs8
-rw-r--r--engine-ecs/examples/extension.rs2
-rw-r--r--engine-ecs/examples/multiple_queries.rs10
-rw-r--r--engine-ecs/examples/optional_component.rs8
-rw-r--r--engine-ecs/examples/relationship.rs4
-rw-r--r--engine-ecs/examples/simple.rs4
-rw-r--r--engine-ecs/examples/with_local.rs4
-rw-r--r--engine-ecs/examples/with_sole.rs8
13 files changed, 36 insertions, 36 deletions
diff --git a/engine-ecs/examples/component_changed_event.rs b/engine-ecs/examples/component_changed_event.rs
index 2788505..a963b41 100644
--- a/engine-ecs/examples/component_changed_event.rs
+++ b/engine-ecs/examples/component_changed_event.rs
@@ -49,14 +49,14 @@ fn main()
world.register_observer(print_changed_greetings);
- world.create_entity((
+ world.spawn((
SomeData { num: 987_654 },
Greeting {
greeting: "Good afternoon".to_string(),
},
));
- world.create_entity((
+ world.spawn((
SomeData { num: 345 },
Greeting { greeting: "Good evening".to_string() },
));
diff --git a/engine-ecs/examples/component_events.rs b/engine-ecs/examples/component_events.rs
index 7c65630..82d9b6c 100644
--- a/engine-ecs/examples/component_events.rs
+++ b/engine-ecs/examples/component_events.rs
@@ -56,9 +56,9 @@ fn main()
world.register_observer(on_cheese_removed);
world.register_observer(on_cheese_crumbs_changed);
- world.create_entity((Cheese { name: "Brie" }, CheeseCrumbs { cnt: 0 }));
- world.create_entity((Cheese { name: "Parmesan" }, CheeseCrumbs { cnt: 0 }));
- world.create_entity((Cheese { name: "Gouda" }, CheeseCrumbs { cnt: 0 }));
+ world.spawn((Cheese { name: "Brie" }, CheeseCrumbs { cnt: 0 }));
+ world.spawn((Cheese { name: "Parmesan" }, CheeseCrumbs { cnt: 0 }));
+ world.spawn((Cheese { name: "Gouda" }, CheeseCrumbs { cnt: 0 }));
world.step();
}
diff --git a/engine-ecs/examples/component_relationship.rs b/engine-ecs/examples/component_relationship.rs
index 0f7b514..a85150e 100644
--- a/engine-ecs/examples/component_relationship.rs
+++ b/engine-ecs/examples/component_relationship.rs
@@ -37,7 +37,7 @@ fn main()
world.register_system(*START_PHASE, print_dog_likers);
- world.create_entity((
+ world.spawn((
Person { name: "Irving".to_string() },
Pair::builder()
.relation::<Likes>()
@@ -45,7 +45,7 @@ fn main()
.build(),
));
- world.create_entity((
+ world.spawn((
Person { name: "Mark".to_string() },
Pair::builder()
.relation::<Likes>()
@@ -53,7 +53,7 @@ fn main()
.build(),
));
- world.create_entity((
+ world.spawn((
Person { name: "Helena".to_string() },
Pair::builder()
.relation::<Likes>()
diff --git a/engine-ecs/examples/component_removed_event.rs b/engine-ecs/examples/component_removed_event.rs
index b15c2c3..23dfc92 100644
--- a/engine-ecs/examples/component_removed_event.rs
+++ b/engine-ecs/examples/component_removed_event.rs
@@ -37,9 +37,9 @@ fn main()
world.register_system(*UPDATE, eat_cheese);
world.register_observer(on_cheese_removed);
- world.create_entity((Cheese { name: "Brie" },));
- world.create_entity((Cheese { name: "Parmesan" },));
- world.create_entity((Cheese { name: "Gouda" },));
+ world.spawn((Cheese { name: "Brie" },));
+ world.spawn((Cheese { name: "Parmesan" },));
+ world.spawn((Cheese { name: "Gouda" },));
world.step();
world.step();
diff --git a/engine-ecs/examples/error_handling.rs b/engine-ecs/examples/error_handling.rs
index 264b12f..2025914 100644
--- a/engine-ecs/examples/error_handling.rs
+++ b/engine-ecs/examples/error_handling.rs
@@ -66,7 +66,7 @@ fn main()
world.set_err_handler(engine_ecs::error::err_handler_log_error);
- world.create_entity((State { value: 0 },));
+ world.spawn((State { value: 0 },));
world.register_system(*UPDATE, do_something_fallible);
diff --git a/engine-ecs/examples/event_loop.rs b/engine-ecs/examples/event_loop.rs
index 62d0876..5202788 100644
--- a/engine-ecs/examples/event_loop.rs
+++ b/engine-ecs/examples/event_loop.rs
@@ -102,15 +102,15 @@ fn main()
{
let mut world = World::new();
- world.create_declared_entity(&SHEER_PHASE);
- world.create_declared_entity(&FEED_PHASE);
- world.create_declared_entity(&AGE_PHASE);
+ world.spawn_declared_entity(&SHEER_PHASE);
+ world.spawn_declared_entity(&FEED_PHASE);
+ world.spawn_declared_entity(&AGE_PHASE);
world.register_system(*SHEER_PHASE, sheer);
world.register_system(*FEED_PHASE, feed);
world.register_system(*AGE_PHASE, age);
- world.create_entity((
+ world.spawn((
Wool { remaining: 30 },
Health { health: 3 },
Name { name: "Bessy" },
diff --git a/engine-ecs/examples/extension.rs b/engine-ecs/examples/extension.rs
index a96c1a7..a2447f8 100644
--- a/engine-ecs/examples/extension.rs
+++ b/engine-ecs/examples/extension.rs
@@ -54,7 +54,7 @@ impl Extension for EnemySpawningExtension
{
collector.add_system(*UPDATE_PHASE, spawn_enemies);
- collector.add_entity((Position { x: 187, y: 30 }, EnemySpawnSource));
+ collector.spawn((Position { x: 187, y: 30 }, EnemySpawnSource));
}
}
diff --git a/engine-ecs/examples/multiple_queries.rs b/engine-ecs/examples/multiple_queries.rs
index 1a4aaad..d04e43f 100644
--- a/engine-ecs/examples/multiple_queries.rs
+++ b/engine-ecs/examples/multiple_queries.rs
@@ -63,23 +63,23 @@ fn main()
world.register_system(*START_PHASE, do_attacks);
- world.create_entity((
+ world.spawn((
Health { health: 100 },
EnemyName { name: "Big spider".to_string() },
));
- world.create_entity((
+ world.spawn((
Health { health: 30 },
EnemyName { name: "Small goblin".to_string() },
));
- world.create_entity((
+ world.spawn((
Health { health: 30 },
EnemyName { name: "Headcrab".to_string() },
));
- world.create_entity((AttackStrength::Strong,));
- world.create_entity((AttackStrength::Weak,));
+ world.spawn((AttackStrength::Strong,));
+ world.spawn((AttackStrength::Weak,));
world.step();
}
diff --git a/engine-ecs/examples/optional_component.rs b/engine-ecs/examples/optional_component.rs
index 79650b9..e9ea4fb 100644
--- a/engine-ecs/examples/optional_component.rs
+++ b/engine-ecs/examples/optional_component.rs
@@ -54,24 +54,24 @@ fn main()
world.register_system(*UPDATE_PHASE, pet_cats);
- world.create_entity((
+ world.spawn((
CatName { name: "Jasper".to_string() },
Aggressivity::Medium,
PettingCapacity { capacity_left: 5 },
));
- world.create_entity((
+ world.spawn((
CatName { name: "Otto".to_string() },
PettingCapacity { capacity_left: 9 },
));
- world.create_entity((
+ world.spawn((
CatName { name: "Carrie".to_string() },
PettingCapacity { capacity_left: 2 },
Aggressivity::High,
));
- world.create_entity((
+ world.spawn((
CatName { name: "Tommy".to_string() },
PettingCapacity { capacity_left: 1 },
Aggressivity::Low,
diff --git a/engine-ecs/examples/relationship.rs b/engine-ecs/examples/relationship.rs
index 749c202..41672ef 100644
--- a/engine-ecs/examples/relationship.rs
+++ b/engine-ecs/examples/relationship.rs
@@ -41,9 +41,9 @@ fn main()
world.register_system(*START_PHASE, print_player_stats);
- let sword_uid = world.create_entity((Sword { attack_strength: 17 },));
+ let sword_uid = world.spawn((Sword { attack_strength: 17 },));
- world.create_entity((
+ world.spawn((
Player,
Health { health: 180 },
Pair::builder()
diff --git a/engine-ecs/examples/simple.rs b/engine-ecs/examples/simple.rs
index e03c003..e879ce3 100644
--- a/engine-ecs/examples/simple.rs
+++ b/engine-ecs/examples/simple.rs
@@ -26,14 +26,14 @@ fn main()
world.register_system(*START_PHASE, say_hello);
- world.create_entity((
+ world.spawn((
SomeData { num: 987_654 },
Greeting {
greeting: "Good afternoon".to_string(),
},
));
- world.create_entity((
+ world.spawn((
SomeData { num: 345 },
Greeting { greeting: "Good evening".to_string() },
));
diff --git a/engine-ecs/examples/with_local.rs b/engine-ecs/examples/with_local.rs
index 2c04f26..6d54b7a 100644
--- a/engine-ecs/examples/with_local.rs
+++ b/engine-ecs/examples/with_local.rs
@@ -61,9 +61,9 @@ fn main()
.initialize((SayHelloState { cnt: 0 },)),
);
- world.create_entity((SomeData { num: 987_654 }, Name { name: "Bob".to_string() }));
+ world.spawn((SomeData { num: 987_654 }, Name { name: "Bob".to_string() }));
- world.create_entity((SomeData { num: 345 },));
+ world.spawn((SomeData { num: 345 },));
world.step();
world.step();
diff --git a/engine-ecs/examples/with_sole.rs b/engine-ecs/examples/with_sole.rs
index 4b2fa44..b76d9dc 100644
--- a/engine-ecs/examples/with_sole.rs
+++ b/engine-ecs/examples/with_sole.rs
@@ -46,14 +46,14 @@ fn main()
{
let mut world = World::new();
- world.create_declared_entity(&PRINT_AMMO_COUNT_PHASE);
+ world.spawn_declared_entity(&PRINT_AMMO_COUNT_PHASE);
world.register_system(*UPDATE_PHASE, count_ammo);
world.register_system(*PRINT_AMMO_COUNT_PHASE, print_total_ammo_count);
- world.create_entity((Ammo { ammo_left: 4 },));
- world.create_entity((Ammo { ammo_left: 7 },));
- world.create_entity((Ammo { ammo_left: 8 },));
+ world.spawn((Ammo { ammo_left: 4 },));
+ world.spawn((Ammo { ammo_left: 7 },));
+ world.spawn((Ammo { ammo_left: 8 },));
world.add_sole(AmmoCounter::default()).unwrap();