summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starling/node.scm22
1 files changed, 14 insertions, 8 deletions
diff --git a/starling/node.scm b/starling/node.scm
index 0872c19..3dabcd0 100644
--- a/starling/node.scm
+++ b/starling/node.scm
@@ -66,6 +66,17 @@
blink)
#:replace (pause))
+;; Allows for non-asset values to be used in asset slots below, such
+;; as textures and fonts that are built in to Chickadee.
+(define-method (add-subscriber thing subscriber slot-name)
+ #f)
+
+(define-method (remove-subscriber thing subscriber slot-name)
+ #f)
+
+(define-method (asset-ref thing)
+ thing)
+
(define-class <meta-node> (<class>))
(define-method (asset-slot? (slot <slot>))
@@ -83,10 +94,7 @@
#:procedure (let ((slot-name (slot-definition-name slot))
(proc (method-procedure (next-method))))
(lambda (obj)
- (let ((value (proc obj)))
- (if (is-a? value <asset>)
- (asset-ref value)
- value)))))
+ (asset-ref (proc obj)))))
(next-method)))
(define-generic on-change)
@@ -119,10 +127,8 @@
(lambda (obj new)
(let ((old (and (slot-bound? obj slot-name)
(slot-ref obj slot-name))))
- (when (is-a? old <asset>)
- (remove-subscriber old obj slot-name))
- (when (is-a? new <asset>)
- (add-subscriber new obj slot-name))
+ (remove-subscriber old obj slot-name)
+ (add-subscriber new obj slot-name)
(proc obj new)))))
(next-method)))