-(let (running game-code)
- (defun game-loop ()
- (setq running t)
- (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)
- (refresh-active-objects)
- (when (functionp game-code) (funcall game-code))
- (render-objects)
- (SDL_GL_SwapBuffers)
- (delay-frame))))
- (setq running nil))
-
- (defun game-running? ()
- running)
-
- (defun set-game-code (game-function)
- (setq game-code game-function)))
-
-(defun quit-game ()
- (free-all-resources)
- (quit-audio)
- (quit-video-mode)
+(define game-loop #f)
+(define game-running? #f)
+(define set-game-code #f)
+
+(let ((running #f) (game-code #f))
+ (set! game-loop
+ (lambda ()
+ (set! running #t)
+; (do () ((quit?))
+ (do () (#f)
+ (init-frame-time)
+; (check-connections)
+; (eval-from-clients)
+; (process-events)
+; (cond ((not (quit?))
+ (cond ((not #f)
+ (glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT))
+; (to-origin)
+; (refresh-active-objects)
+ (if (procedure? game-code) (game-code))
+; (render-objects)
+ (SDL_GL_SwapBuffers)
+ (delay-frame))))
+ (set! running #f)))
+
+ (set! game-running?
+ (lambda ()
+ running))
+
+ (set! set-game-code
+ (lambda (game-function)
+ (set! game-code game-function))))
+
+(define (quit-game)
+; (free-all-resources)
+ (quit-audio)
+ (quit-video-mode)