From 65b948c4b2b72bbf86304e9e2d84e0527b69b97f Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sun, 9 Sep 2012 08:59:53 +0200 Subject: [PATCH] Main loop with recursivity --- src/gacela.scm | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/gacela.scm b/src/gacela.scm index 61ff672..1a5a0d9 100644 --- a/src/gacela.scm +++ b/src/gacela.scm @@ -100,27 +100,29 @@ (define (quit-gacela) (hide-all-mobs) (set! game-loop-thread #f) - (set! loop-flag #f)) + (set! loop-flag #f) + (quit-video)) (define (game-loop) (refresh-active-mobs) (init-video *width-screen* *height-screen* *bpp-screen* #:title *title* #:mode *mode* #:fps *frames-per-second*) (set! loop-flag #t) - (while loop-flag - (init-frame-time) + (let loop () + (cond (loop-flag + (init-frame-time) ; (check-connections) - (process-events) - (cond ((quit-signal?) - (quit-gacela)) - (else - (clear-screen) - (to-origin) - (refresh-active-mobs) - (run-mobs) - (run-extensions) - (flip-screen) - (delay-frame)))) - (quit-video)) + (process-events) + (cond ((quit-signal?) + (quit-gacela)) + (else + (clear-screen) + (to-origin) + (refresh-active-mobs) + (run-mobs) + (run-extensions) + (flip-screen) + (delay-frame) + (loop))))))) (define (gacela-script args) (while loop-flag (sleep 1))) -- 2.39.5