summaryrefslogtreecommitdiff
path: root/scenes/game.scm
diff options
context:
space:
mode:
Diffstat (limited to 'scenes/game.scm')
-rw-r--r--scenes/game.scm45
1 files changed, 27 insertions, 18 deletions
diff --git a/scenes/game.scm b/scenes/game.scm
index 0a7cce9..70bf91a 100644
--- a/scenes/game.scm
+++ b/scenes/game.scm
@@ -1,5 +1,5 @@
;;; The Inevitable Game
-;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 David Thompson <davet@gnu.org>
;;;
;;; This program is free software: you can redistribute it and/or
@@ -20,11 +20,11 @@
#:use-module (chickadee math easings)
#:use-module (chickadee math rect)
#:use-module (chickadee math vector)
- #:use-module ((chickadee render color) #:hide (color))
- #:use-module (chickadee render font)
- #:use-module (chickadee render shapes)
- #:use-module (chickadee render texture)
- #:use-module (chickadee render tiled)
+ #:use-module (chickadee graphics color)
+ #:use-module (chickadee graphics font)
+ #:use-module ((chickadee graphics path) #:hide (move-to))
+ #:use-module (chickadee graphics texture)
+ #:use-module (chickadee graphics tiled)
#:use-module ((sdl2 input keyboard) #:prefix sdl2:)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
@@ -425,18 +425,27 @@ conversation."
weight
music))
(player (object stats)))
- (for-each (lambda (property index)
- (let* ((value (property player))
- (start (vec2 x (- y (* step index))))
- (end-y (- y (* step index)))
- (end (vec2 (+ x 100) end-y)))
- (draw-line start end
- #:thickness thickness #:color red)
- (when (> value 0)
- (draw-line start (vec2 (+ x value) end-y)
- #:thickness thickness #:color green))))
- properties
- (iota (length properties)))))
+ (let ((painters
+ (map (lambda (property index)
+ (let* ((value (property player))
+ (start (vec2 x (- y (* step index))))
+ (end-y (- y (* step index)))
+ (end (vec2 (+ x 100) end-y)))
+ (with-style
+ ((stroke-color red)
+ (stroke-width thickness))
+ (stroke
+ (line start end)))
+ (when (> value 0)
+ (with-style
+ ((stroke-color green)
+ (stroke-width thickness))
+ (stroke
+ (line start (vec2 (+ x value) end-y)))))))
+ properties
+ (iota (length properties)))))
+ (draw-canvas
+ (make-canvas (apply superimpose painters))))))
(define-method (draw (game <game>) alpha)
(draw-tile-map (asset-ref (tile-map game))