diff options
Diffstat (limited to 'ecs/examples')
| -rw-r--r-- | ecs/examples/event_loop.rs | 6 | ||||
| -rw-r--r-- | ecs/examples/extension.rs | 4 | ||||
| -rw-r--r-- | ecs/examples/multiple_queries.rs | 4 | ||||
| -rw-r--r-- | ecs/examples/optional_component.rs | 2 | ||||
| -rw-r--r-- | ecs/examples/relationship.rs | 4 | ||||
| -rw-r--r-- | ecs/examples/simple.rs | 2 | ||||
| -rw-r--r-- | ecs/examples/with_local.rs | 4 | ||||
| -rw-r--r-- | ecs/examples/with_sole.rs | 2 | 
8 files changed, 15 insertions, 13 deletions
diff --git a/ecs/examples/event_loop.rs b/ecs/examples/event_loop.rs index c9f7757..2365eb0 100644 --- a/ecs/examples/event_loop.rs +++ b/ecs/examples/event_loop.rs @@ -21,7 +21,7 @@ struct Name      name: &'static str,  } -fn sheer(query: Query<(Wool, Name)>) +fn sheer(query: Query<(&mut Wool, &Name)>)  {      for (mut wool, name) in &query {          if wool.remaining == 0 { @@ -37,7 +37,7 @@ fn sheer(query: Query<(Wool, Name)>)      }  } -fn feed(query: Query<(Health, Name)>) +fn feed(query: Query<(&mut Health, &Name)>)  {      for (mut health, name) in &query {          health.health += 1; @@ -46,7 +46,7 @@ fn feed(query: Query<(Health, Name)>)      }  } -fn age(query: Query<(Health, Name)>, mut actions: Actions) +fn age(query: Query<(&mut Health, &Name)>, mut actions: Actions)  {      for (mut health, name) in &query {          if health.health <= 2 { diff --git a/ecs/examples/extension.rs b/ecs/examples/extension.rs index ddde32c..f6282e1 100644 --- a/ecs/examples/extension.rs +++ b/ecs/examples/extension.rs @@ -20,8 +20,8 @@ enum EvilnessLevel  }  fn spawn_enemies( -    spawner_query: Query<(EnemySpawnSource, Position)>, -    enemies_query: Query<(EvilnessLevel,)>, +    spawner_query: Query<(&EnemySpawnSource, &Position)>, +    enemies_query: Query<(&EvilnessLevel,)>,      mut actions: Actions,  )  { diff --git a/ecs/examples/multiple_queries.rs b/ecs/examples/multiple_queries.rs index 1ae9d19..e0c957f 100644 --- a/ecs/examples/multiple_queries.rs +++ b/ecs/examples/multiple_queries.rs @@ -31,8 +31,8 @@ impl Display for EnemyName  }  fn do_attacks( -    attacker_query: Query<(AttackStrength,)>, -    enemy_query: Query<(Health, EnemyName)>, +    attacker_query: Query<(&AttackStrength,)>, +    enemy_query: Query<(&mut Health, &EnemyName)>,  )  {      for (attack_strength,) in &attacker_query { diff --git a/ecs/examples/optional_component.rs b/ecs/examples/optional_component.rs index bcc0c54..488dad2 100644 --- a/ecs/examples/optional_component.rs +++ b/ecs/examples/optional_component.rs @@ -21,7 +21,7 @@ pub struct CatName      name: String,  } -fn pet_cats(query: Query<(CatName, PettingCapacity, Option<Aggressivity>)>) +fn pet_cats(query: Query<(&CatName, &mut PettingCapacity, &Option<Aggressivity>)>)  {      for (cat_name, mut petting_capacity, aggressivity) in &query {          let Some(aggressivity) = aggressivity else { diff --git a/ecs/examples/relationship.rs b/ecs/examples/relationship.rs index 1b3d1de..240884a 100644 --- a/ecs/examples/relationship.rs +++ b/ecs/examples/relationship.rs @@ -19,7 +19,9 @@ struct Health  struct Holding; -fn print_player_stats(player_query: Query<(Player, Health, Relationship<Holding, Sword>)>) +fn print_player_stats( +    player_query: Query<(&Player, &Health, &Relationship<Holding, Sword>)>, +)  {      for (_, health, sword_relationship) in &player_query {          println!("Player health: {}", health.health); diff --git a/ecs/examples/simple.rs b/ecs/examples/simple.rs index 6429035..0169062 100644 --- a/ecs/examples/simple.rs +++ b/ecs/examples/simple.rs @@ -13,7 +13,7 @@ struct Greeting      greeting: String,  } -fn say_hello(query: Query<(SomeData, Greeting)>) +fn say_hello(query: Query<(&SomeData, &Greeting)>)  {      for (data, greeting) in &query {          println!("{}: {}", greeting.greeting, data.num); diff --git a/ecs/examples/with_local.rs b/ecs/examples/with_local.rs index 0872dfc..4658fc0 100644 --- a/ecs/examples/with_local.rs +++ b/ecs/examples/with_local.rs @@ -21,7 +21,7 @@ struct SayHelloState      cnt: usize,  } -fn say_hello(query: Query<(SomeData,)>, mut state: Local<SayHelloState>) +fn say_hello(query: Query<(&SomeData,)>, mut state: Local<SayHelloState>)  {      for (data,) in &query {          println!("Hello there. Count {}: {}", state.cnt, data.num); @@ -30,7 +30,7 @@ fn say_hello(query: Query<(SomeData,)>, mut state: Local<SayHelloState>)      }  } -fn say_whats_up(query: Query<(SomeData, Name)>, mut state: Local<SayHelloState>) +fn say_whats_up(query: Query<(&SomeData, &Name)>, mut state: Local<SayHelloState>)  {      for (data, name) in &query {          println!( diff --git a/ecs/examples/with_sole.rs b/ecs/examples/with_sole.rs index 47aa0b3..689e562 100644 --- a/ecs/examples/with_sole.rs +++ b/ecs/examples/with_sole.rs @@ -15,7 +15,7 @@ struct AmmoCounter      counter: u32,  } -fn count_ammo(query: Query<(Ammo,)>, mut ammo_counter: Single<AmmoCounter>) +fn count_ammo(query: Query<(&Ammo,)>, mut ammo_counter: Single<AmmoCounter>)  {      for (ammo,) in &query {          println!("Found {} ammo", ammo.ammo_left);  | 
