diff options
author | HampusM <hampus@hampusmat.com> | 2025-01-05 22:03:34 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2025-01-05 22:03:34 +0100 |
commit | a44e663eb6d4aaf567dd35f2676014ba5aaa9e00 (patch) | |
tree | cd81d1f61b33e1905d6b3def851e5be18838556b /ecs/examples/event_loop.rs | |
parent | cd385ddedc767c953f24109ec3ffe0a07d247ff5 (diff) |
feat(ecs): allow control over component mutability in query
Diffstat (limited to 'ecs/examples/event_loop.rs')
-rw-r--r-- | ecs/examples/event_loop.rs | 6 |
1 files changed, 3 insertions, 3 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 { |