summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/lines.scm31
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)