bevy-game/src/main.rs

35 lines
665 B
Rust
Raw Normal View History

2023-03-18 03:04:16 -07:00
use bevy::prelude::*;
2023-03-18 12:04:25 -07:00
#[derive(Component)]
struct Person;
#[derive(Component)]
struct Name(String);
fn add_people(mut commands: Commands) {
commands.spawn((Person, Name("Skero Tlamenai".into())));
commands.spawn((Person, Name("Wagoyesa Luutunen".into())));
commands.spawn((Person, Name("Mak'lazi Heyorem".into())));
}
fn greetings(query: Query<&Name, With<Person>>) {
for name in &query {
println!("Gamarjoba, {}", name.0)
}
}
2023-03-18 03:04:16 -07:00
fn gamarjoba() {
println!("Gamarjoba, munde!");
}
2023-03-18 02:44:55 -07:00
fn main() {
2023-03-18 03:04:16 -07:00
App::new()
2023-03-18 12:04:25 -07:00
.add_startup_system(add_people)
.add_system(greetings)
2023-03-18 03:04:16 -07:00
.add_system(gamarjoba)
.run();
2023-03-18 02:44:55 -07:00
}