summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-07-02 21:13:28 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-07-02 21:13:28 -0400
commitf186a28057d69e8ebb4b90ba76024be074d3677b (patch)
tree0b5a853093d5cf3f32a5679a9383768eec019593
parentbb0b6b0760efa78c6182e812e345507fd3f8431e (diff)
Allow some sprite properties to be signals.
* sly/sprite.scm (%sprite-position, %sprite-scale, %sprite-rotation, %sprite-color): New procedures. (sprite-position, sprite-scale, sprite-rotation, sprite-color): Use signal-ref-maybe.
-rw-r--r--sly/sprite.scm13
1 files changed, 9 insertions, 4 deletions
diff --git a/sly/sprite.scm b/sly/sprite.scm
index 3a304a6..c8e0fe4 100644
--- a/sly/sprite.scm
+++ b/sly/sprite.scm
@@ -81,14 +81,19 @@
(%make-sprite drawable position scale rotation color anchor vertices animator)
sprite?
(drawable sprite-drawable set-sprite-drawable)
- (position sprite-position set-sprite-position)
- (scale sprite-scale set-sprite-scale)
- (rotation sprite-rotation set-sprite-rotation)
- (color sprite-color set-sprite-color)
+ (position %sprite-position set-sprite-position)
+ (scale %sprite-scale set-sprite-scale)
+ (rotation %sprite-rotation set-sprite-rotation)
+ (color %sprite-color set-sprite-color)
(anchor sprite-anchor set-sprite-anchor)
(vertices sprite-vertices)
(animator sprite-animator))
+(define sprite-position (compose signal-ref-maybe %sprite-position))
+(define sprite-scale (compose signal-ref-maybe %sprite-scale))
+(define sprite-rotation (compose signal-ref-maybe %sprite-rotation))
+(define sprite-color (compose signal-ref-maybe %sprite-color))
+
(define (update-sprite-vertices! sprite)
(let ((texture (sprite-texture sprite)))
(pack-texture-vertices (sprite-vertices sprite)