conifer icon indicating copy to clipboard operation
conifer copied to clipboard

Universe

Open nbrr opened this issue 4 years ago • 1 comments

User should be able to pass a state through iterations of their callback. So far in my experiments I have added another &mut parameter to the callback so that each execution can modify the universe and remember it later. Do we want to think about the execution as centered on the universe or on the device? e.g. universe.run(config, canvas, callback) or config.run(universe, canvas, callback).

nbrr avatar Sep 01 '20 21:09 nbrr

i'm curious why this can't be done with Rust's capture of variables in closures?

let mut my_universe = Universe::new();
run(move |canvas,event|{
     my_universe.do_something();
});

richardanaya avatar Sep 02 '20 01:09 richardanaya