summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2022-12-18 19:57:39 -0500
committerDavid Thompson <dthompson2@worcester.edu>2022-12-18 19:57:39 -0500
commit966cfb53458e3aad27a092fcebd804a2fce6f474 (patch)
tree88ea6de053aeee9ec638494c0371192104424d84
parentd6be9dd5e7258dfaeb93da9ddf4b2474c0e792d7 (diff)
node-2d: Use resize method.
-rw-r--r--catbird/node-2d.scm18
1 files changed, 8 insertions, 10 deletions
diff --git a/catbird/node-2d.scm b/catbird/node-2d.scm
index 84c86d8..a390201 100644
--- a/catbird/node-2d.scm
+++ b/catbird/node-2d.scm
@@ -765,8 +765,9 @@ A."
(case slot-name
((texture)
(let ((new (artifact (->asset new))))
- (set! (width sprite) (texture-width new))
- (set! (height sprite) (texture-height new))))))
+ (resize sprite
+ (texure-width new)
+ (texture-height new))))))
(define-method (render (sprite <sprite>) alpha)
(let ((t (texture sprite)))
@@ -920,8 +921,7 @@ A."
(set-canvas-painter! (canvas c) p)
;; (set! (origin-x canvas) (- (rect-x bb)))
;; (set! (origin-y canvas) (- (rect-y bb)))
- (set! (width c) (rect-width bb))
- (set! (height c) (rect-height bb))))))
+ (resize c (rect-width bb) (rect-height bb))))))
(define-method (on-boot (c <canvas>))
(refresh-painter c))
@@ -977,8 +977,7 @@ A."
(page-reset! p)
(page-write! p c)
(let ((bb (page-bounding-box p)))
- (set! (width label) (rect-width bb))
- (set! (height label) (rect-height bb)))
+ (resize label (rect-width bb) (rect-height bb)))
(realign label)))
(define-method (on-boot (label <label>))
@@ -1030,10 +1029,9 @@ A."
(define-method (on-boot (particles <particles>))
;; Default bounding box size.
- (when (zero? (width particles))
- (set! (width particles) 32.0))
- (when (zero? (height particles))
- (set! (height particles) 32.0)))
+ (resize particles
+ (if (zero? (width particles)) 32.0 (width particles))
+ (if (zero? (height particles)) 32.0 (height particles))))
(define-method (update (node <particles>) dt)
(update-particles (particles node)))