summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starling/node-2d.scm26
1 files changed, 19 insertions, 7 deletions
diff --git a/starling/node-2d.scm b/starling/node-2d.scm
index 1e3c76f..34a1786 100644
--- a/starling/node-2d.scm
+++ b/starling/node-2d.scm
@@ -113,7 +113,7 @@
start-time
change-animation
- <nine-patch>
+ <9-patch>
top-margin
bottom-margin
left-margin
@@ -761,14 +761,26 @@
(painter #:accessor painter #:init-keyword #:painter #:watch? #t)
(canvas #:accessor canvas #:init-thunk make-empty-canvas))
-(define-method (initialize (path <path>) args)
- (next-method)
- (set-canvas-painter! (canvas path) (painter path)))
+(define-method (refresh-painter (path <path>))
+ (let ((p (painter path))
+ ;;(bb (painter-bounding-box p))
+ )
+ (set-canvas-painter! (canvas path) (painter path))
+ ;; (set! (origin-x path) (- (rect-x bb)))
+ ;; (set! (origin-y path) (- (rect-y bb)))
+ ;; (set! (width path) (rect-width bb))
+ ;; (set! (height path) (rect-height bb))
+ ))
+
+(define-method (on-boot (path <path>))
+ (refresh-painter path))
(define-method (on-change (path <path>) slot-name old new)
- (pk 'change slot-name old new)
- (when (eq? slot-name 'painter)
- (set-canvas-painter! (canvas path) new)))
+ (case slot-name
+ ((painter)
+ (refresh-painter path))
+ (else
+ (next-method))))
(define-method (render (path <path>) alpha)
(draw-canvas* (canvas path) (world-matrix path)))