-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Very low priority until all the drawing methods are completed. Postponed in order to keep the library's implementation as simple as possible while we are still figuring everything out. This will involve refactoring quite a bit of the behind the scenes code in the codebase. We'll have to plan out what those changes should be to meet all the requirements of this feature.
The idea is that we would have an API that looks something like this:
let mut window = TurtleWindow::new();
let turtle1 = window.add_turtle();
let turtle2 = window.add_turtle();
turtle1.forward(100.0);
turtle2.right(90.0);
turtle2.forward(100.0);The animations would still occur sequentially in this example (one turtle would move at a time). Ideally we would like the turtles to be able to run in multiple threads so that multiple turtles can be drawing on the screen at once.
This feature is excellent for teaching parallel and concurrent programming.
- Add
reset()andclear()methods toDrawingthat clear all of the drawings. The turtlereset()andclear()methods only clear that turtle's drawings - Are turtles cloneable? Would clone copy the drawings of the turtle or just its current state? (Position, angle, pen, etc.)
- Does dropping a turtle delete its drawings? (Answer is probably no since each turtle is just a "handle" to data represented in the renderer but still worth considering)
-
Turtleneeds to beSendin order for each turtle to be moved into a separate thread, havingTurtlebeSyncis probably not desirable - Add a
examples/maze_multipleexample that uses multiple turtles to draw the maze concurrently - Document that
wait_for_clickdoes not work for multiple turtles because it consumes events from the global event pipe
Note that this feature has nothing to do with async. There is a separate issue (#17) open for that.