From 0748cbd5d487084648fdc439963e73cdf2afc6c0 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Wed, 8 Jan 2025 02:44:23 -0800 Subject: [PATCH] Time resource --- src/main.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 84b2ee1..e1fe3d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,9 @@ struct Person; #[derive(Component)] struct Name(String); +#[derive(Resource)] +struct GreetTimer(Timer); + fn add_people(mut commands: Commands) { commands.spawn((Person, Name("Lars Larson".to_string()))); commands.spawn((Person, Name("Cedric Fagbottom".to_string()))); @@ -18,9 +21,11 @@ fn gamarjoba() { println!("Gamarjoba, munde!"); } -fn greet_people(query: Query<&Name, With>) { - for name in &query { - println!("'sup {}", name.0); +fn greet_people(time: Res