Skip to content

Greater control of execution loop #140

@Kevinpgalligan

Description

@Kevinpgalligan

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))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions