#:use-module (gl)
#:export (image
move
- scale))
+ scale
+ over))
(define (calculate proc-or-value)
(if (procedure? proc-or-value)
(set! h/2 (/ (sdl2:surface-height image) 2)))
(gl-enable (oes-framebuffer-object texture-2d))
(sdl2:bind-texture texture)
+ (gl-enable (oes-framebuffer-object blend))
+ (set-gl-blend-function (blending-factor-src src-alpha)
+ (blending-factor-dest one-minus-src-alpha))
(gl-begin (begin-mode quads)
(gl-texture-coordinates 0 0)
(gl-vertex (- w/2) h/2 0)
(gl-vertex w/2 (- h/2) 0)
(gl-texture-coordinates 0 1)
(gl-vertex (- w/2) (- h/2) 0))
+ (gl-disable (oes-framebuffer-object blend))
(gl-disable (oes-framebuffer-object texture-2d))))))
(define* (move scene x y #:optional (z 0))
(make-scene
"scale"
(lambda ()
- (gl-scale x y z)
+ (gl-scale (calculate x)
+ (calculate y)
+ (calculate z))
(display-scene scene))))
+
+(define (over . scenes)
+ (make-scene
+ "over"
+ (lambda ()
+ (let display ((sc scenes))
+ (cond ((not (null? sc))
+ (with-gl-push-matrix
+ (display-scene (car sc)))
+ (display (cdr sc))))))))