summaryrefslogtreecommitdiff
path: root/examples/lines.scm
blob: 75aadf1e95d4fd83a469d64085722f307498251b (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
(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 #v((random 640) (random 480))
                         #v((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))

(run-game/sdl #:draw draw)