You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if there were any provided solutions, "tips", or possible contributions I could make for composing systems.
For example, taking the example system:
let update_positions = SystemBuilder::new("update_positions").write_resource::<ExampleResource1>().read_resource::<ExampleResource2>().with_query(<(Write<Pos>,Read<Vel>)>::query()).build(|_,mut world,(res1, res2), query| {
res1.0 = res2.0.clone();// Write the mutable resource from the immutable resourcefor(mut pos, vel)in query.iter_mut(&mut world){
pos.0 += vel.0;
pos.1 += vel.1;
pos.2 += vel.2;}});
It would be nice to be able to compose the function passed to build to e.g. make this system execute every 1000 milliseconds, something like:
.build(timed_system(1000, |_,mut world,(res1, res2), query| {
res1.0 = res2.0.clone();// Write the mutable resource from the immutable resourcefor(mut pos, vel)in query.iter_mut(&mut world){
pos.0 += vel.0;
pos.1 += vel.1;
pos.2 += vel.2;}}));
But if you define some function that takes in a FnMut with the same type parameters as build, the query argument type can no longer be inferred, which makes this difficult to work with. Separately, I think there would be no way to specify what resources the "wrapper" system needs without modifying the scheduler.
However, maybe this is just the wrong approach overall, or I'm looking for something different from legion_systems.
I was wondering if there were any provided solutions, "tips", or possible contributions I could make for composing systems.
For example, taking the example system:
It would be nice to be able to compose the function passed to
build
to e.g. make this system execute every 1000 milliseconds, something like:But if you define some function that takes in a
FnMut
with the same type parameters asbuild
, thequery
argument type can no longer be inferred, which makes this difficult to work with. Separately, I think there would be no way to specify what resources the "wrapper" system needs without modifying the scheduler.However, maybe this is just the wrong approach overall, or I'm looking for something different from
legion_systems
.This is maybe related to #31.
And thanks for
legion
, really enjoying using it so far.The text was updated successfully, but these errors were encountered: