Permalink
Browse files

Updated Nehe tutorial 5 to use a new keyboard handling routine.

  • Loading branch information...
1 parent ff0c9df commit 8ad45bafcd8e105897967059389a1c02852cc044 Sean Grove committed Apr 15, 2010
Showing with 10 additions and 2 deletions.
  1. +10 −2 examples/nehe_tutorials_5.scm
@@ -94,6 +94,14 @@
(vertex 1 -1 -1)) ;; Bottom Left
))))
-;; q for quit in this tutorial
(define (handle-keyboard-state delta)
- (if (kb:key-pressed? #\q) (exit)))
+ ;; bind keys to actions
+ (let* ((walk-length 0.01)
+ (key-map
+ `((#\q . ,(lambda () (exit))))))
+
+ ;; execute actions for keys in *keyboard-state*
+ (for-each (lambda (key)
+ (and-let* ((handler (alist-ref key key-map)))
+ (handler)))
+ *keyboard-state*)))

0 comments on commit 8ad45ba

Please sign in to comment.