summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starling/node-2d.scm24
1 files changed, 23 insertions, 1 deletions
diff --git a/starling/node-2d.scm b/starling/node-2d.scm
index 8e3cad6..19ca545 100644
--- a/starling/node-2d.scm
+++ b/starling/node-2d.scm
@@ -33,6 +33,7 @@
#:use-module (chickadee render shapes)
#:use-module (chickadee render sprite)
#:use-module (chickadee render texture)
+ #:use-module (chickadee render tiled)
#:use-module (chickadee render viewport)
#:use-module (chickadee scripting)
#:use-module (ice-9 match)
@@ -89,7 +90,11 @@
<label>
font
- text))
+ text
+
+ <tile-map>
+ tile-map
+ layers))
;;;
@@ -475,3 +480,20 @@
(define-method (render (label <label>) alpha)
(draw-text* (asset-ref (font label)) (text label) (world-matrix label)))
+
+
+;;;
+;;; Tiled Map
+;;;
+
+(define-class <tile-map> (<node-2d>)
+ (tile-map #:accessor tile-map #:init-keyword #:map)
+ (layers #:accessor layers #:init-keyword #:layers #:init-form #f))
+
+(define-method (initialize (node <tile-map>) initargs)
+ (next-method))
+
+(define-method (render (node <tile-map>) alpha)
+ (let ((m (asset-ref (tile-map node))))
+ (draw-tile-map* m (world-matrix node) (tile-map-rect m)
+ #:layers (layers node))))