diff options
-rw-r--r-- | starling/node-2d.scm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/starling/node-2d.scm b/starling/node-2d.scm index 00d909a..f439ebe 100644 --- a/starling/node-2d.scm +++ b/starling/node-2d.scm @@ -92,7 +92,6 @@ <sprite> texture - texcoords source-rect blend-mode tint @@ -573,7 +572,7 @@ ;;; (define-class <sprite> (<node-2d>) - (texture #:accessor texture #:init-keyword #:texture #:asset? #t) + (texture #:accessor texture #:init-keyword #:texture #:asset? #t #:watch? #t) (batch #:accessor batch #:init-keyword #:batch #:init-form #f) @@ -630,12 +629,15 @@ (define-method (sync-texture (sprite <atlas-sprite>)) (set! (texture sprite) (texture-atlas-ref (atlas sprite) (index sprite)))) -(define-method (initialize (sprite <atlas-sprite>) initargs) - (next-method) +(define-method (on-boot (sprite <atlas-sprite>)) (sync-texture sprite)) (define-method (on-change (sprite <atlas-sprite>) slot-name old new) - (sync-texture sprite)) + (case slot-name + ((atlas index) + (sync-texture sprite)) + (else + (next-method)))) ;;; |