summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/render/texture.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/chickadee/render/texture.scm b/chickadee/render/texture.scm
index 2b4755e..9a1421a 100644
--- a/chickadee/render/texture.scm
+++ b/chickadee/render/texture.scm
@@ -274,17 +274,18 @@ coordinate rects denoting the various tiles within."
(rects rects))
(match rects
(() (%make-texture-atlas texture v))
- ((r . rest)
- (vector-set! v i r)
+ (((x y width height) . rest)
+ (vector-set! v i (make-texture-region texture x y width height))
(loop (1+ i) rest))))))
(define (texture-atlas texture . rects)
"Return a new atlas for TEXTURE containing RECTS, a series of
-texture coordinate rect arguments denoting the various tiles within."
+4-tuples in the form (x y width height) describing the various tiles
+within."
(list->texture-atlas texture rects))
(define (texture-atlas-ref atlas index)
- "Return the texture coordinate rect associated with INDEX in
+ "Return the texture region associated with INDEX in
ATLAS."
(vector-ref (texture-atlas-vector atlas) index))
@@ -308,7 +309,7 @@ terrain."
(define (make-tile tx ty)
(let* ((x (+ (* tx (+ tile-width spacing)) margin))
(y (+ (* ty (+ tile-height spacing)) margin)))
- (make-rect (/ x w) (/ y h) sw th)))
+ (make-texture-region texture x y tile-width tile-height)))
(let y-loop ((y 0))
(when (< y rows)
(let x-loop ((x 0))