X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgacela.scm;h=c8c9fffc35d178e1b83ad104cca44d78fb19c1bb;hb=ee8cc28a7551d08466af97636c38e55516a22876;hp=ff28dbb6900f1ae7c574af0db8e0151a06317adf;hpb=023823491bfe1a64e136bcc2d47c6ec5803f23bf;p=gacela.git diff --git a/src/gacela.scm b/src/gacela.scm index ff28dbb..c8c9fff 100644 --- a/src/gacela.scm +++ b/src/gacela.scm @@ -26,6 +26,7 @@ ;;; SDL Initialization Subsystem (define init-sdl #f) +(define sdl-on? #f) (define quit-sdl #f) (let ((initialized #f)) @@ -34,6 +35,10 @@ (cond ((not initialized) (SDL_Init SDL_INIT_EVERYTHING) (set! initialized #t)) (else initialized)))) + (set! sdl-on? + (lambda () + (if initialized #t #f))) + (set! quit-sdl (lambda () (SDL_Quit) @@ -235,21 +240,22 @@ (lambda () (set! mobs (get-active-mobs)) (set! running #t) - (quit? #f) + (quit! #f) (do () ((quit?)) - (init-frame-time) -; (check-connections) -; (eval-from-clients) - (process-events) - (cond ((not (quit?)) - (glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT)) - (to-origin) - (cond ((mobs-changed?) (set! mobs (get-active-mobs)))) - (if (procedure? game-code) (game-code)) - (run-mob-actions mobs) - (render-mobs mobs) - (SDL_GL_SwapBuffers) - (delay-frame)))) + (if (sdl-on?) (init-frame-time)) + (check-connections) + (eval-from-clients) + (cond ((sdl-on?) + (process-events) + (cond ((not (quit?)) + (glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT)) + (to-origin) + (cond ((mobs-changed?) (set! mobs (get-active-mobs)))) + (if (procedure? game-code) (game-code)) + (run-mob-actions mobs) + (render-mobs mobs) + (SDL_GL_SwapBuffers) + (delay-frame)))))) (set! running #f))) (set! game-running?