diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-01-20 21:10:57 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-01-20 21:10:57 -0500 |
commit | 7c540f61a710847fd59033d3d2ee1dfc6364b928 (patch) | |
tree | acb4a04c277a72b81809e1779afeea3769cda914 | |
parent | 5b81b48d3055a5be364cf3aa1a2b786c2daf65ab (diff) |
Remove obsolete examples.
-rw-r--r-- | examples/action.scm | 39 | ||||
-rw-r--r-- | examples/pong.scm | 82 | ||||
-rw-r--r-- | examples/rewrite-test.scm | 52 | ||||
-rw-r--r-- | examples/scenes.scm | 60 |
4 files changed, 0 insertions, 233 deletions
diff --git a/examples/action.scm b/examples/action.scm deleted file mode 100644 index b2a43b6..0000000 --- a/examples/action.scm +++ /dev/null @@ -1,39 +0,0 @@ -(use-modules (2d actions) - (2d agenda) - (2d coroutine) - (2d game) - (2d scene) - (2d sprite) - (2d stage) - (2d vector2)) - -(define (enter sprite) - (let ((size (game-resolution actions-demo))) - (schedule-action - (action-parallel - ;; Move horizontally across the screen in 60 frames. - (lerp (lambda (x) - (set-sprite-position! - sprite - (vector2 x (/ (vy size) 2)))) - 0 (vx size) 60) - ;; Rotate 1080 degrees in 120 frames. - (lerp (lambda (angle) - (set-sprite-rotation! sprite angle)) - 0 360 120))))) - -(define actions-scene - (make-scene - "Actions" - #:init (lambda () - (load-sprite "images/ghost.png" - #:position (vector2 320 240))) - #:enter enter - #:draw draw-sprite)) - -(define actions-demo - (make-game - #:title "Actions" - #:first-scene actions-scene)) - -(run-game actions-demo) diff --git a/examples/pong.scm b/examples/pong.scm deleted file mode 100644 index 5ff1979..0000000 --- a/examples/pong.scm +++ /dev/null @@ -1,82 +0,0 @@ -(use-modules (srfi srfi-1) - (srfi srfi-9) - (2d color) - (2d game) - (2d keyboard) - (2d math) - (2d rect) - (2d signals) - (2d sprite) - (2d texture) - (2d time) - (2d vector2) - (2d window)) - -(define-record-type <paddle> - (%make-paddle y) - paddle? - (y paddle-y) - (speed paddle-speed)) - -(define-record-type <ball> - (make-ball position velocity) - ball? - (position ball-position) - (velocity ball-velocity)) - -(define window-width 640) -(define window-height 480) -(define half-width (/ window-width 2)) -(define half-height (/ window-height 2)) - -(with-window (make-window #:title "FRP is cool" - #:resolution (vector2 window-width - window-height) - #:fullscreen? #f) - (define paddle-texture (load-texture "images/paddleBlue.png")) - (define ball-texture (load-texture "images/ballBlue.png")) - - (define paddle-speed 5) - (define ball-speed 4) - (define ball-hitbox (make-rect -8 -8 16 16)) - - (define (move-paddle directions) - (signal-fold (lambda (new old) - (clamp 0 window-height (+ (* new paddle-speed) old))) - half-height - (signal-lift vy (time-every directions)))) - - (define player1-paddle (move-paddle key-wasd)) - (define player2-paddle (move-paddle key-arrows)) - - (define (wall-bounce position) - (let ((rect (rect-move ball-hitbox position))) - (cond ((> (rect-bottom rect) window-height) - (vector2 (vx position) - (- (vy position)))) - (else - position)))) - - (define ball (signal-fold (lambda (direction position) - (wall-bounce (v+ (vscale direction ball-speed) position))) - (vector2 half-width half-height) - (time-every (make-signal #:init (vector2 1 1))))) - - (define quit-on-esc - (signal-lift (lambda (down?) - (when down? - (quit-game))) - (key-down? 'escape))) - - (define draw - (let ((paddle-sprite (make-sprite paddle-texture)) - (ball-sprite (make-sprite ball-texture))) - (lambda () - (set-sprite-position! paddle-sprite (vector2 0 (signal-ref player1-paddle))) - (draw-sprite paddle-sprite) - (set-sprite-position! paddle-sprite (vector2 window-width (signal-ref player2-paddle))) - (draw-sprite paddle-sprite) - (set-sprite-position! ball-sprite ball) - (draw-sprite ball-sprite)))) - - (run-game #:draw draw)) diff --git a/examples/rewrite-test.scm b/examples/rewrite-test.scm deleted file mode 100644 index 760afb0..0000000 --- a/examples/rewrite-test.scm +++ /dev/null @@ -1,52 +0,0 @@ -(use-modules (srfi srfi-1) - (2d color) - (2d game) - (2d keyboard) - (2d signals) - (2d sprite) - (2d texture) - (2d time) - (2d vector2) - (2d window)) - -(with-window (make-window #:title "FRP is cool" - #:resolution (vector2 640 480) - #:fullscreen? #f) - (define speed 4) - - ;; Move when arrow keys are pressed. - (define move - (signal-fold (lambda (direction position) - (v+ (vscale direction speed) position)) - (vector2 320 240) - (time-every key-arrows))) - - (define ghost-texture (load-texture "images/ghost.png")) - - (define ghost (make-sprite ghost-texture #:position move)) - - (define follower-count 8) - - (define followers - (list-tabulate - follower-count - (lambda (i) - (make-sprite ghost-texture - ;; Follow ghost with some delay. - #:position (time-delay (* (- follower-count i) 10) move) - ;; Make each ghost more translucent than the last. - #:color (let ((alpha (/ (1+ i) - (* 2 follower-count)))) - (make-color 1 1 1 alpha)))))) - - (define quit-on-esc - (signal-lift (lambda (down?) - (when down? - (quit-game))) - (key-down? 'escape))) - - (define (draw) - (for-each draw-sprite followers) - (draw-sprite ghost)) - - (run-game #:draw draw)) diff --git a/examples/scenes.scm b/examples/scenes.scm deleted file mode 100644 index 46d9956..0000000 --- a/examples/scenes.scm +++ /dev/null @@ -1,60 +0,0 @@ -(use-modules (2d game) - (2d scene) - (2d stage) - (2d sprite) - (2d vector2)) - -;; Press the RETURN key to toggle between the 2 scenes. - -;;; -;;; Scene 1 -;;; - -(define (make-sprite-1) - (load-sprite "images/ghost.png" - #:position (vector2 320 240))) - -(define (scene-1-key-down sprite key mod unicode) - (when (eq? key 'return) - (replace-scene scene-2))) - -(define scene-1 - (make-scene - "Scene 1" - #:init make-sprite-1 - #:enter (lambda (sprite) (display "Enter Scene 1\n")) - #:exit (lambda (sprite) (display "Exit Scene 1\n")) - #:draw draw-sprite - #:events (append - (default-events) - `((key-down . ,scene-1-key-down))))) - -;;; -;;; Scene 2 -;;; - -(define (make-sprite-2) - (load-sprite "images/stars.png" - #:position (vector2 320 240))) - -(define (scene-2-key-down sprite key mod unicode) - (when (eq? key 'return) - (replace-scene scene-1))) - -(define scene-2 - (make-scene - "Scene 2" - #:init make-sprite-2 - #:enter (lambda (sprite) (display "Enter Scene 2\n")) - #:exit (lambda (sprite) (display "Exit Scene 2\n")) - #:draw draw-sprite - #:events (append - (default-events) - `((key-down . ,scene-2-key-down))))) - -(define scenes-demo - (make-game - #:title "Scenes" - #:first-scene scene-1)) - -(run-game scenes-demo) |