Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greater control of execution loop #140

Open
Kevinpgalligan opened this issue Jan 22, 2024 · 1 comment
Open

Greater control of execution loop #140

Kevinpgalligan opened this issue Jan 22, 2024 · 1 comment

Comments

@Kevinpgalligan
Copy link
Contributor

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
Copy link
Contributor Author

Useful article on timing stuff in SDL2: https://thenumb.at/cpp-course/sdl2/08/08.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant