summaryrefslogtreecommitdiff
path: root/starling/asset.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2020-09-26 16:52:29 -0400
committerDavid Thompson <dthompson@vistahigherlearning.com>2020-09-26 16:52:29 -0400
commitc365d816698ed769683abfd814ec41e3ae3abc79 (patch)
treee323a3424eee05477df2ce4f6511e13d7d0eedf5 /starling/asset.scm
parent6bc296631b7cc6988112489030ad7a8c18648e88 (diff)
Migrate over changes from unfinished spring lisp game jam entry.
Diffstat (limited to 'starling/asset.scm')
-rw-r--r--starling/asset.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/starling/asset.scm b/starling/asset.scm
index a14a050..d898655 100644
--- a/starling/asset.scm
+++ b/starling/asset.scm
@@ -22,6 +22,7 @@
;;; Code:
(define-module (starling asset)
+ #:use-module (chickadee render texture)
#:use-module (ice-9 ftw)
#:use-module (ice-9 match)
#:use-module (oop goops)
@@ -38,7 +39,8 @@
reload-modified-assets
clear-asset-cache
asset-ref
- define-asset))
+ define-asset
+ load-tile-atlas))
(define-class <asset> ()
(watch? #:allocation #:class #:init-form #f)
@@ -198,3 +200,9 @@
#:file-name file-name
#:loader loader
#:loader-args (list loader-args ...))))
+
+;; Convenience procedure for loading tilesets
+(define* (load-tile-atlas file-name tile-width tile-height
+ #:key (margin 0) (spacing 0))
+ (split-texture (load-image file-name) tile-width tile-height
+ #:margin margin #:spacing spacing))