lordmauve / wasabi2d

Cutting-edge 2D game framework for Python
https://wasabi2d.readthedocs.io/
GNU Lesser General Public License v3.0
154 stars 24 forks source link

Allow pausing a nursery #72

Open lordmauve opened 2 years ago

lordmauve commented 2 years ago

There are situations when it would be helpful to pause an entire nursery.

This would be more powerful than pausing a clock because pausing a clock still allows tasks to resume for input events or concurrency primitives.

For example, a pause screen needs to pause the entire game, including controls like the fire button.

Pausing a nursery would entail pausing all tasks within it, the task inside the nursery context, and any nurseries linked to those tasks, recursively. Paused means that if the task is resumed it will not actually be run until unpaused.

Pausing will need to be scoped so that if two of the containing nurseries for a task are paused the task will not run until both nurseries are unpaused (not either).