fix the way we break from the main loop
This commit is contained in:
parent
a10a88f6bc
commit
246668c4cc
1 changed files with 14 additions and 13 deletions
|
|
@ -10,21 +10,22 @@
|
|||
(:export :main :quit))
|
||||
(in-package :stoe)
|
||||
|
||||
(defun main-loop (&optional unprotected)
|
||||
"Run the protected main-loop. An error will be catched with the possibility to
|
||||
(let ((exit-main-loop nil))
|
||||
(defun main-loop (&optional unprotected)
|
||||
"Run the protected main-loop. An error will be catched with the possibility to
|
||||
continue unless `unprotected' is t."
|
||||
(let ((clock (make-clock)))
|
||||
(catch 'exit-main-loop
|
||||
(loop (restartable unprotected
|
||||
(update-current-time)
|
||||
(update-clock clock (get-delta-time))
|
||||
(modules:update (clock-delta clock))
|
||||
(eval-repl)
|
||||
(sleep 0.01))))))
|
||||
(setf exit-main-loop nil)
|
||||
(let ((clock (make-clock)))
|
||||
(loop while (not exit-main-loop)
|
||||
do (restartable unprotected
|
||||
(update-current-time)
|
||||
(update-clock clock (get-delta-time))
|
||||
(modules:update (clock-delta clock))
|
||||
(sleep 0.01)))))
|
||||
|
||||
(defun quit ()
|
||||
"Quit the main loop."
|
||||
(throw 'exit-main-loop nil))
|
||||
(defun quit ()
|
||||
"Quit the main loop."
|
||||
(setf exit-main-loop t)))
|
||||
|
||||
(defun main (&optional argv)
|
||||
"Run the program."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue