diff options
author | David Thompson <dthompson2@worcester.edu> | 2017-01-25 22:26:58 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2017-01-25 22:26:58 -0500 |
commit | 0c9e24e2bd5daa263ec0b90013101f39ea35158d (patch) | |
tree | 2fc8e5eb6201876b187a43412e4986066d38a9e8 /examples/lines.scm | |
parent | a68ae4ea988e09741eaa98e5514d78170d028ab6 (diff) |
examples: Add line segment example.
* examples/lines.scm: New file.
Diffstat (limited to 'examples/lines.scm')
-rw-r--r-- | examples/lines.scm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/lines.scm b/examples/lines.scm new file mode 100644 index 0000000..117f781 --- /dev/null +++ b/examples/lines.scm @@ -0,0 +1,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) |