commit 1910619ea775ad5c4b84c0beca05473baf101c67
parent ff1d5c353cb6f145e038da06c823807b0cae876f
Author: Yuval Langer <yuvallangerontheroad@gmail.com>
Date: Sun, 29 Oct 2023 09:28:34 +0000
Change background colour and global fill style values used in drawing procedures.
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/main.scm b/main.scm
@@ -41,7 +41,9 @@
(define ctx
(%inline ".getContext" canvas "2d"))
-(set! (.fillStyle ctx) "rgb(200, 0, 0)")
+(define background-fill-style "hsla(0, 0%, 0%, .2)")
+(define player-fill-style "rgb(200, 0, 0)")
+(define brick-fill-style "rgb(200, 0, 0)")
(define brick-width (/ (.width canvas)
3))
@@ -57,12 +59,14 @@
50))))
(define (draw-player player)
+ (set! (.fillStyle ctx) player-fill-style)
(draw-rect (assq-ref player 'x)
(assq-ref player 'y)
player-width
player-height))
(define (draw-rect x y width height)
+ (set! (.fillStyle ctx) brick-fill-style)
(%inline ".fillRect"
ctx
x
@@ -71,7 +75,8 @@
height))
(define (clear-rect)
- (%inline ".clearRect"
+ (set! (.fillStyle ctx) background-fill-style)
+ (%inline ".fillRect"
ctx
0
0