X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgacela.scm;h=c8c9fffc35d178e1b83ad104cca44d78fb19c1bb;hb=a6e0eb4c5e06bb6107acf40eb9f6a89e691d585e;hp=54b705fcf4f0553840f7fbb7095448525c61fe59;hpb=f97bfd3b82bd6c337c85468a8b5e2c14ef8d63ab;p=gacela.git diff --git a/src/gacela.scm b/src/gacela.scm index 54b705f..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,20 +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)) - (process-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?