; (run-mobs)
; (run-extensions)
(if game-loop-procedure
- (set! game-elements (game-loop-procedure game-elements)))
+ (catch #t
+ (lambda () (set! game-elements (game-loop-procedure game-elements)))
+ (lambda (key . args) #f)))
(process-game-elements game-elements)
(flip-screen)
(delay-frame)
- (loop)))))))
+ (loop game-elements)))))))
(define (game-running?)
game-loop-flag)
(cond ((not (list? elements))
(process-game-elements (list elements)))
(else
- (draw-meshes (filter (lambda (e) (mesh? e)) elements))
-)))
+ (draw-meshes (filter (lambda (e) (mesh? e)) elements)))))
+
+(define (draw-meshes meshes)
+ (cond ((null? meshes) #t)
+ (else
+ (catch #t
+ (lambda () (mesh-draw (car meshes)))
+ (lambda (key . args) #f))
+ (draw-meshes (cdr meshes)))))
;;; Extensions to main loop
#:texture-coord texture-coord
#:color color)))
-(define* (draw-square #:key (size 1) texture color)
+(define* (draw-square size #:key texture color)
(draw-rectangle size size #:texture texture #:color color))
(define* (draw-cube #:key (size 1)
(mesh-properties-set! m (list ,@(map (lambda (a) `(cons ',a ,a)) (names-arguments args))))
m))))
+(define-mesh (square size #:key texture color)
+ (draw-square size #:texture texture #:color color))
+
(module-map (lambda (sym var)
(if (not (eq? sym '%module-public-interface))