blob: 5dcbe1047c2cda17f21b169c837e2621646e1e35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
(load "./scripts/structs.scm")
(load "./scripts/utils.scm")
(load "./scripts/prompt.scm")
(load "./scripts/gol.scm")
(define camera-offset (make-point))
(define space-pressed #f)
(define (update)
(prompt-update)
(cond ((not prompt-active)
(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))
)
(cond ((and (rl-is-key-down KEY_SPACE) (not space-pressed))
(set! space-pressed #t)
(run-step))
)
(if (not (rl-is-key-down KEY_SPACE))
(set! space-pressed #f)
)
))
)
(define (draw)
(prompt-draw)
(for-each (lambda (cell)
(rl-draw-rectangle
(+ (* (car cell) 30) (point-x camera-offset))
(+ (* (cdr cell) 30) (point-y camera-offset))
30
30
(make-color 190 100 255))
) (hash-table-keys current-cells))
)
|