#:use-module ((sdl2 surface) #:prefix sdl2:)
#:use-module (gl)
#:export (image
- move-xy
+ move
scale))
+(define (calculate proc-or-value)
+ (if (procedure? proc-or-value)
+ (proc-or-value)
+ proc-or-value))
+
(define (image filename)
(make-scene
"image"
(gl-vertex (- w/2) (- h/2) 0))
(gl-disable (oes-framebuffer-object texture-2d))))))
-(define (move-xy x y scene)
- (define (to-integer n)
- (inexact->exact (round n)))
+(define* (move scene x y #:optional (z 0))
(make-scene
- "move-xy"
+ "move"
(lambda ()
- (let ((xy (list (to-integer (if (procedure? x) (x) x))
- (to-integer (if (procedure? y) (y) y)))))
- (display-scene scene #:xy xy)))))
+ (gl-translate (calculate x)
+ (calculate y)
+ (calculate z))
+ (display-scene scene))))
(define* (scale scene x #:optional (y x) (z y))
(make-scene