summaryrefslogtreecommitdiff
path: root/examples/lines.scm
blob: 117f781b3d56521889d5d67ba016c408f4e20946 (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 color)
             (chickadee math vector)
             (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)