diff options
Diffstat (limited to 'scenes')
-rw-r--r-- | scenes/game.scm | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/scenes/game.scm b/scenes/game.scm index a51fd18..4ae862d 100644 --- a/scenes/game.scm +++ b/scenes/game.scm @@ -37,6 +37,7 @@ #:use-module (characters) #:use-module (characters lorenzo) #:use-module (characters reaper) + #:use-module (utils) #:use-module (config) #:export (game)) @@ -123,28 +124,6 @@ map's object layer." #:name 'stats #:object player #:position (vec2 10.0 (- %height 10.0)))))) -(define* (arrange-text text #:key - (character-width 8.0) - (margin 0.0) - (max-width %width)) - "Take the string TEXT and split it at spaces so that it fits in the -given MAX-WIDTH. Return a list of lines." - (match (fold (lambda (chunk acc) - (match acc - ((#:width width #:result (and (current-line . tail) lines)) - (let* ((len (+ 1 (string-length chunk))) - (chunk-width (* len character-width)) - (new-width (+ chunk-width width))) - (if (< (+ new-width margin) max-width) - `(#:width ,new-width - #:result ,(cons (string-append current-line " " chunk) tail)) - `(#:width ,chunk-width - #:result ,(cons chunk lines))))))) - '(#:width 0 #:result ("")) - (string-tokenize text)) - ((#:width _ #:result lines) - (reverse lines)))) - (define* (collides? player game #:key (layer "collision")) (let* ((pos (position player)) (offset (origin game)) |