Query
This commit is contained in:
parent
d679712dd8
commit
932866a943
1181
Cargo.lock
generated
1181
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.14.2", features = ["dynamic_linking"] }
|
||||
bevy = { version = "0.15.1", features = ["dynamic_linking"] }
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
22
src/main.rs
22
src/main.rs
@ -1,12 +1,32 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
#[derive(Component)]
|
||||
struct Person;
|
||||
|
||||
#[derive(Component)]
|
||||
struct Name(String);
|
||||
|
||||
fn add_people(mut commands: Commands) {
|
||||
commands.spawn((Person, Name("Lars Larson".to_string())));
|
||||
commands.spawn((Person, Name("Cedric Fagbottom".to_string())));
|
||||
commands.spawn((Person, Name("Orlando Tampa".to_string())));
|
||||
|
||||
|
||||
}
|
||||
|
||||
fn gamarjoba() {
|
||||
println!("Gamarjoba, munde!");
|
||||
}
|
||||
|
||||
fn greet_people(query: Query<&Name, With<Person>>) {
|
||||
for name in &query {
|
||||
println!("'sup {}", name.0);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_systems(Update, gamarjoba)
|
||||
.add_systems(Startup, add_people)
|
||||
.add_systems(Update, (gamarjoba, greet_people))
|
||||
.run();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user