custom plugin
This commit is contained in:
parent
16a9fca8ce
commit
19f4c5280e
1 changed files with 10 additions and 5 deletions
15
src/main.rs
15
src/main.rs
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue