]> git.jsancho.org Git - gacela.git/blobdiff - gacela.lisp
(no commit message)
[gacela.git] / gacela.lisp
index 299ab90b9a21b328337bde69d2a8b598a5742b4d..4197d22d077e2b488fc7f692d48285aced148848 100644 (file)
      (init-video-mode)
      (set-game-code game-function)
      (cond ((not (game-running?))
-           (init-frame-time)
-           (process-events)
            (game-loop)))))
 
 (let (running game-code)
   (defun game-loop ()
     (setq running t)
     (do () ((quit?))
-       (glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT))
-       (to-origin)
-       (when (functionp game-code) (funcall game-code))
-       (SDL_GL_SwapBuffers)
-       (delay-frame)
        (init-frame-time)
        (check-connections)
        (eval-from-clients)
-       (process-events))
+       (process-events)
+       (cond ((not (quit?))
+              (glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT))
+              (to-origin)
+              (refresh-active-objects)
+              (when (functionp game-code) (funcall game-code))
+              (render-objects)
+              (SDL_GL_SwapBuffers)
+              (delay-frame))))
     (setq running nil))
 
   (defun game-running? ()
   (free-all-resources)
   (quit-audio)
   (quit-video-mode)
-  (quit-all-mobs)
+;  (quit-all-mobs)
+  (kill-all-objects)
 ;  (clear-events)
 ;  (quit-events)
   (quit-sdl))