From 0c9e24e2bd5daa263ec0b90013101f39ea35158d Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 25 Jan 2017 22:26:58 -0500 Subject: examples: Add line segment example. * examples/lines.scm: New file. --- examples/lines.scm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/lines.scm (limited to 'examples') 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) -- cgit v1.2.3