summaryrefslogtreecommitdiff
path: root/scripts/main.scm
diff options
context:
space:
mode:
authorHenrique Alves <henrique.alves@itsjungle.xyz>2024-05-05 01:13:04 +0300
committerHenrique Alves <henrique.alves@itsjungle.xyz>2024-05-05 01:13:04 +0300
commit595895c0bf1565510ed23e5c95863cafae1daea7 (patch)
tree33fd5db8bff6a94476a84a72b2b2073960e05114 /scripts/main.scm
parent72fc0084e45314c7ebfa641f2a20e2ecff358914 (diff)
downloadgamejam-slgj-2024-595895c0bf1565510ed23e5c95863cafae1daea7.tar.gz
gamejam-slgj-2024-595895c0bf1565510ed23e5c95863cafae1daea7.tar.bz2
gamejam-slgj-2024-595895c0bf1565510ed23e5c95863cafae1daea7.zip
basic GoL
Diffstat (limited to 'scripts/main.scm')
-rw-r--r--scripts/main.scm26
1 files changed, 21 insertions, 5 deletions
diff --git a/scripts/main.scm b/scripts/main.scm
index f480053..7480777 100644
--- a/scripts/main.scm
+++ b/scripts/main.scm
@@ -6,12 +6,28 @@
(define camera-offset (make-point))
-(define (update)
- (prompt-update)
-
+(define (update)
+ ;; (prompt-update) ;; it's eating the input!
(if (rl-is-key-down KEY_DOWN)
+ (set! (point-y camera-offset) (+ (point-y camera-offset) 2))
+ )
+
+ (if (rl-is-key-down KEY_UP)
+ (set! (point-y camera-offset) (+ (point-y camera-offset) -2))
+ )
+
+ (if (rl-is-key-down KEY_LEFT)
+ (set! (point-x camera-offset) (+ (point-x camera-offset) -2))
+ )
+
+ (if (rl-is-key-down KEY_RIGHT)
+ (set! (point-x camera-offset) (+ (point-x camera-offset) 2))
+ )
+
+ (if (eq? (rl-get-key-pressed) KEY_SPACE)
(run-step)
)
+
)
(define (draw)
@@ -19,8 +35,8 @@
(for-each (lambda (cell)
(rl-draw-rectangle
- (* (car cell) 30)
- (* (cdr cell) 30)
+ (+ (* (car cell) 30) (point-x camera-offset))
+ (+ (* (cdr cell) 30) (point-y camera-offset))
30
30
(make-color 190 100 255))