summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-01-19 14:43:54 -0500
committerDavid Thompson <dthompson2@worcester.edu>2015-01-19 14:43:54 -0500
commit61a331bab3633a2daaaa5bb5eed5479915e9a22a (patch)
treea3f6d11b864ea992b974f54b4edcae31a9e16c6c
parent8f3bd694d3910ffc6902b99e3190c23a6a75cae5 (diff)
render: tileset: Use custom record type printer.
* sly/render/tileset.scm: Use a much more brief, readable record type printer that does not print out all of the tiles, and thus repeating the parent texture n times, which is problematic for large values of n.
-rw-r--r--sly/render/tileset.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/sly/render/tileset.scm b/sly/render/tileset.scm
index 0122471..2047f6f 100644
--- a/sly/render/tileset.scm
+++ b/sly/render/tileset.scm
@@ -24,6 +24,7 @@
(define-module (sly render tileset)
#:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-9 gnu)
#:use-module (srfi srfi-42)
#:use-module (sly render texture)
#:export (<tileset>
@@ -48,6 +49,16 @@
(margin tileset-margin)
(spacing tileset-spacing))
+(set-record-type-printer! <tileset>
+ (lambda (tileset port)
+ (format port
+ "#<tileset texture: ~a width: ~d height ~d margin: ~d spacing: ~d>"
+ (tileset-texture tileset)
+ (tileset-width tileset)
+ (tileset-height tileset)
+ (tileset-margin tileset)
+ (tileset-spacing tileset))))
+
(define (split-texture texture width height margin spacing)
"Split TEXTURE into a vector of texture regions of WIDTH x HEIGHT
size. SPACING refers to the number of pixels separating each