toying around
This commit is contained in:
parent
0e1061609c
commit
693f79de3c
2 changed files with 43 additions and 16 deletions
31
src/scene.rs
Normal file
31
src/scene.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
pub struct BuildScenePlugin;
|
||||
|
||||
impl Plugin for BuildScenePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app
|
||||
.add_startup_system(build_scene)
|
||||
.add_system(print_positions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Component)]
|
||||
struct Person;
|
||||
|
||||
#[derive(Component)]
|
||||
struct Position { x: f32, y: f32 }
|
||||
|
||||
|
||||
fn build_scene(mut commands: Commands) {
|
||||
commands.spawn()
|
||||
.insert(Person)
|
||||
.insert(Position{ x: 10.0, y: 10.0 });
|
||||
}
|
||||
|
||||
fn print_positions(query : Query<&Position>) {
|
||||
for position in query.iter() {
|
||||
println!("position {:?} {:?}", position.x, position.y)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue