diff options
author | David Thompson <dthompson2@worcester.edu> | 2013-11-30 10:35:20 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2013-11-30 10:35:20 -0500 |
commit | dec204b546e128dcf3eb7ad30a21e97ead1a69f1 (patch) | |
tree | 10f5d6f441699dc0a35b322b8651ef6d770363e7 /examples | |
parent | 09c26c42800fa9a3d0da94401e649dc7b5265bd9 (diff) |
Add temporary rewrite-test example.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/rewrite-test.scm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/rewrite-test.scm b/examples/rewrite-test.scm new file mode 100644 index 0000000..54664ac --- /dev/null +++ b/examples/rewrite-test.scm @@ -0,0 +1,32 @@ +(use-modules (2d game) + (2d signals) + (2d sprite) + (2d vector2)) + +(define sprite + (delay (load-sprite "images/ghost.png" + #:position (vector2 320 240)))) + +(define quit-on-esc + (signal-lift (lambda (down?) + (when down? + (quit-game))) + (key-is-down 'escape))) + +(define sprite-position + (signal-lift (lambda (pos) + (when (game-running?) + (set-sprite-position! (force sprite) pos))) + mouse-position)) + +(define (draw) + (draw-sprite (force sprite))) + +;; TODO: make the quit condition a signal + +(define demo + (make-game + #:title "Simple Demo" + #:draw draw)) + +(run-game demo) |