summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-01-19 14:43:31 -0500
committerDavid Thompson <dthompson2@worcester.edu>2015-01-19 14:43:31 -0500
commit8f3bd694d3910ffc6902b99e3190c23a6a75cae5 (patch)
tree69c934db7da929b4d43df5aa5c527e3ba7331684
parent0deb96a904845129a148fe440a65fb6ca699939d (diff)
render: tileset: Add texture field.
* sly/render/tileset.scm (tileset-texture): New procedure. (%make-tileset): New 'texture' argument. (make-tileset, load-tileset): Use new constructor.
-rw-r--r--sly/render/tileset.scm15
1 files changed, 7 insertions, 8 deletions
diff --git a/sly/render/tileset.scm b/sly/render/tileset.scm
index 9e136fb..0122471 100644
--- a/sly/render/tileset.scm
+++ b/sly/render/tileset.scm
@@ -30,6 +30,7 @@
make-tileset
load-tileset
tileset?
+ tileset-texture
tileset-tiles
tileset-width
tileset-height
@@ -38,8 +39,9 @@
tileset-ref))
(define-record-type <tileset>
- (%make-tileset tiles width height margin spacing)
+ (%make-tileset texture tiles width height margin spacing)
tileset?
+ (texture tileset-texture)
(tiles tileset-tiles)
(width tileset-width)
(height tileset-height)
@@ -71,18 +73,15 @@ tiles."
height
margin
spacing)))
- (%make-tileset tiles width height margin spacing)))
+ (%make-tileset texture tiles width height margin spacing)))
(define* (load-tileset filename width height
#:optional #:key (margin 0) (spacing 0))
"Return a new tileset that is built by loading the texture at
FILENAME and splitting the texture into tiles."
- (let* ((tiles (split-texture (load-texture filename)
- width
- height
- margin
- spacing)))
- (%make-tileset tiles width height margin spacing)))
+ (let* ((texture (load-texture filename))
+ (tiles (split-texture texture width height margin spacing)))
+ (%make-tileset texture tiles width height margin spacing)))
(define (tileset-ref tileset i)
"Return the tile texture of TILESET at index I."