summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dir-locals.el3
-rw-r--r--sly/render.scm10
2 files changed, 11 insertions, 2 deletions
diff --git a/.dir-locals.el b/.dir-locals.el
index f8534e6..cd94516 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -21,4 +21,5 @@
(eval . (put 'with-vertex-buffer 'scheme-indent-function 1))
(eval . (put 'with-sprite-batch 'scheme-indent-function 2))
(eval . (put 'uniform-let 'scheme-indent-function 1))
- (eval . (put 'call-with-surface 'scheme-indent-function 1)))))
+ (eval . (put 'call-with-surface 'scheme-indent-function 1))
+ (eval . (put 'render/signal 'scheme-indent-function 1)))))
diff --git a/sly/render.scm b/sly/render.scm
index 875f7c1..6bc917b 100644
--- a/sly/render.scm
+++ b/sly/render.scm
@@ -31,6 +31,7 @@
#:use-module (gl)
#:use-module (gl enums)
#:use-module (gl low-level)
+ #:use-module (sly signal)
#:use-module (sly wrappers gl)
#:use-module ((sly math transform) #:prefix t:)
#:use-module (sly render color)
@@ -117,7 +118,8 @@
clear-screen
uniform-let
with-color
- render-mesh))
+ render-mesh
+ render/signal))
;;;
;;; Transformation matrix stack.
@@ -524,3 +526,9 @@ COLOR and applies RENDERER."
`((mvp ,(graphics-model-view-transform gfx))
(texture? ,(not (texture-null? (graphics-texture gfx)))))
draw-graphics-mesh!)))))
+
+(define-syntax-rule (render/signal ((name signal) ...) renderer)
+ "Evaluate RENDERER whenever a bound signal changes."
+ (let ((s (signal-let ((name signal) ...) renderer)))
+ (lambda (gfx)
+ ((signal-ref s) gfx))))