diff --git a/Cargo.toml b/Cargo.toml index c737fed958..763d52d4bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Carter Anderson "] edition = "2018" [dependencies] -legion = { git = "https://github.com/TomGillen/legion.git", rev = "8628b227bcbe57582fffb5e80e73c634ec4eebd9" } +legion = { git = "https://github.com/TomGillen/legion.git", rev = "940ef3bfcb77e5d074ee3184b776ff1600da228d" } legion_transform = { path = "src/transform" } wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "44fa1bc2fa208fa92f80944253e0da56cb7ac1fe"} glam = "0.8.4" diff --git a/examples/instancing.rs b/examples/instancing.rs index 69f81d92bb..5caa58adb5 100644 --- a/examples/instancing.rs +++ b/examples/instancing.rs @@ -25,10 +25,20 @@ struct Wander { } fn main() { - AppBuilder::new().add_defaults().setup(&setup).run(); + AppBuilder::new() + .add_defaults() + .setup_world(setup) + .setup_systems(|builder| { + builder + .add_system(build_wander_system()) + .add_system(build_navigate_system()) + .add_system(build_move_system()) + .add_system(build_print_status_system()) + }) + .run(); } -fn setup(world: &mut World, scheduler: &mut SystemScheduler) { +fn setup(world: &mut World) { let cube = Mesh::load(MeshType::Cube); let cube_handle = { let mut mesh_storage = world @@ -38,13 +48,6 @@ fn setup(world: &mut World, scheduler: &mut SystemScheduler) { mesh_storage.add(cube, "cube") }; - let transform_system_bundle = transform_system_bundle::build(world); - scheduler.add_systems(AppStage::Update, transform_system_bundle); - scheduler.add_system(AppStage::Update, build_wander_system()); - scheduler.add_system(AppStage::Update, build_navigate_system()); - scheduler.add_system(AppStage::Update, build_move_system()); - scheduler.add_system(AppStage::Update, build_print_status_system()); - world.insert( (), vec![ @@ -112,7 +115,7 @@ fn build_wander_system() -> Box { Write, )>::query()) .build(move |_, world, time, person_query| { - for (_, translation, mut wander, mut navigation_point) in person_query.iter(world) { + for (_, translation, mut wander, mut navigation_point) in person_query.iter_mut(world) { wander.elapsed += time.delta_seconds; if wander.elapsed >= wander.duration { let direction = math::vec3( @@ -141,7 +144,7 @@ fn build_navigate_system() -> Box { Write, )>::query()) .build(move |_, world, _, person_query| { - for (_, translation, mut velocity, navigation_point) in person_query.iter(world) { + for (_, translation, mut velocity, navigation_point) in person_query.iter_mut(world) { let distance = navigation_point.target - translation.0; if distance.length() > 0.01 { let direction = distance.normalize(); @@ -158,7 +161,7 @@ fn build_move_system() -> Box { .read_resource::