2022-07-15 23:42:22 +02:00
|
|
|
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)
|
2022-08-07 22:26:12 +02:00
|
|
|
.insert(Position { x: 10.0, y: 10.0 } );
|
|
|
|
|
|
|
|
// camera
|
|
|
|
// commands.spawn_bundle(OffAxisProjection {
|
|
|
|
// transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
|
|
|
|
// ..default()
|
|
|
|
// });
|
2022-07-15 23:42:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn print_positions(query : Query<&Position>) {
|
|
|
|
for position in query.iter() {
|
2022-08-07 22:26:12 +02:00
|
|
|
|
|
|
|
// println!("position {:?} {:?}", position.x, position.y)
|
|
|
|
|
2022-07-15 23:42:22 +02:00
|
|
|
}
|
|
|
|
}
|