Greater control of execution loop
Kevinpgalligan opened this issue · 1 comments
Kevinpgalligan commented
Summarising a brainstorming session between me and @Gleefre.
- It would be nice if the user had greater control of sketch's "game loop".
- This includes controlling the frame rate.
- Also, there could be a separate
update-state
method, allowing the user to decouple their physics simulation/whatever from the drawing loop, with a separate FPS. - Idle render will have to have a flag to disable it if the user is controlling the render themselves.
- sdl2kit contains its own implementation of a game loop, but it's not decomposed into reusable parts. We could either submit a pull request there or copy the parts we need.
Example of how this might work:
(defsketch my-sketch ...)
(defun main ()
(let ((sketch (make-instance 'my-sketch :idle-render nil)))
(loop (handle-events sketch)
(render sketch)
(update-state sketch))))
Kevinpgalligan commented
Useful article on timing stuff in SDL2: https://thenumb.at/cpp-course/sdl2/08/08.html