From a44e663eb6d4aaf567dd35f2676014ba5aaa9e00 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 5 Jan 2025 22:03:34 +0100 Subject: feat(ecs): allow control over component mutability in query --- ecs/examples/event_loop.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ecs/examples/event_loop.rs') 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 { -- cgit v1.2.3-18-g5258