Walther/clovers

DRY the draw & draw_gui code

Closed this issue · 3 comments

Currently, draw.rs and draw_gui.rs have a lot of overlap.

Ideally, there should probably be

  • one main loader function for the scene
  • one gui render loop and one non-gui render loop, shared features combined into helpers
  • one file writer that gets called at the end of either mode (currently, GUI mode does not save a file!)

One main loader function has been added in a PR.
Two other tasks remain: render loops could maybe still use some unifying where possible, and the GUI mode still does not save a file.

Making the GUI mode save a file might require some advanced thinking due to the GUI window event loop "hijacking" the thread and being unable to return values to its caller.

Look into channels https://doc.rust-lang.org/stable/rust-by-example/std_misc/channels.html or possibly figure out an alternative.

Closing with #85 , further improvements possible as always though.