summaryrefslogtreecommitdiff
path: root/examples/lines.scm
blob: e6b19298eeb3e9b0697b122a8dadb80d98e3331f (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
(use-modules (ice-9 match)
             (srfi srfi-1)
             (chickadee)
             (chickadee math vector)
             (chickadee render color)
             (chickadee render shapes))

(define lines
  (list-tabulate 48
                 (lambda (n)
                   (list (vec2 (random 640) (random 480))
                         (vec2 (random 640) (random 480))
                         (make-color (random:uniform)
                                     (random:uniform)
                                     (random:uniform)
                                     1.0)
                         (1+  (random 16))))))

(define (draw alpha)
  (for-each (match-lambda
              ((start end color thickness)
               (draw-line start end
                          #:feather 1.5
                          #:color color
                          #:thickness thickness)))
            lines))

(add-hook! draw-hook draw)
(add-hook! quit-hook abort-game)

(run-game)