diff options
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)))) |