custom plugin

main
Zynh Ludwig 2024-07-29 23:05:19 -07:00
parent 16a9fca8ce
commit 19f4c5280e
1 changed files with 10 additions and 5 deletions

View File

@ -1,11 +1,7 @@
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, add_people)
.add_systems(Update, (hello_world, greet_people).chain())
.run();
App::new().add_plugins((DefaultPlugins, HelloPlugin)).run();
}
fn hello_world() {
@ -29,3 +25,12 @@ fn greet_people(query: Query<&Name, With<Person>>) {
println!("hello {}!", name.0);
}
}
pub struct HelloPlugin;
impl Plugin for HelloPlugin {
fn build(&self, app: &mut App) {
app.add_systems(Startup, add_people)
.add_systems(Update, (hello_world, greet_people).chain());
}
}