diff options
author | David Thompson <dthompson2@worcester.edu> | 2013-06-25 18:18:25 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2013-06-25 18:18:25 -0400 |
commit | 0410eda4a37a123c173f971d2050b41f79eb74fc (patch) | |
tree | 217c6f654234c132b6fbcc6f9c974cb2fb8976eb /examples | |
parent | 6c3f3066945ae49c612d3a52e6496b26a9d55193 (diff) |
Update examples to use new keycode enumeration.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/particles.scm | 13 | ||||
-rw-r--r-- | examples/simple.scm | 11 |
2 files changed, 12 insertions, 12 deletions
diff --git a/examples/particles.scm b/examples/particles.scm index 28420b6..a446bff 100644 --- a/examples/particles.scm +++ b/examples/particles.scm @@ -9,7 +9,8 @@ (2d sprite) (2d game-loop) (2d window) - (2d vector)) + (2d vector) + (2d input)) (set! *random-state* (random-state-from-platform)) @@ -63,7 +64,7 @@ (define stars (load-sprite "stars.png" #:anchor #(0 0))) (define particle-image (load-texture "bullet.png")) -(define num-particles 300) +(define num-particles 1800) (define particles (list-tabulate num-particles (lambda (n) @@ -78,10 +79,10 @@ (set-key-down-callback (lambda (key) (key-down key))) (define (key-down key) - (case key - ((SDLK_ESCAPE SDLK_q) - (close-window) - (quit)))) + (cond ((or (= key (keycode escape)) + (= key (keycode q))) + (close-window) + (quit)))) (define (render) (draw-sprite stars) diff --git a/examples/simple.scm b/examples/simple.scm index a988d25..dd09cb0 100644 --- a/examples/simple.scm +++ b/examples/simple.scm @@ -2,18 +2,17 @@ (figl gl) (2d sprite) (2d game-loop) - (2d window)) + (2d window) + (2d input) + (ice-9 format)) (define window-width 800) (define window-height 600) (define sprite #f) (define (key-down key) - (display key) (newline) - (case key - ;; Quit program when ESCAPE or Q is pressed. - ;; For now we have to use the SDL keycodes, but not for long! - ((SDLK_ESCAPE SDLK_q) + (cond ((or (= key (keycode escape)) + (= key (keycode q))) (close-window) (quit)))) |