added cursor keys

This commit is contained in:
Dave Griffiths 2009-07-02 14:46:07 +01:00
parent 6569ea30f9
commit b4eef24816

View file

@ -1,5 +1,5 @@
#lang scheme/base
(require fluxus-016/drflux)
;#lang scheme/base
;(require fluxus-016/drflux)
(require scheme/class)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1395,10 +1395,10 @@
(set-camera-transform (mtranslate (vector 0 0 -1))))
(define/public (update)
(when (key-pressed "a") (set! yaw (+ yaw 1)))
(when (key-pressed "d") (set! yaw (- yaw 1)))
(when (key-pressed "w") (set! tilt (+ tilt 1)))
(when (key-pressed "s") (set! tilt (- tilt 1)))
(when (or (key-pressed "a") (key-special-pressed 100)) (set! yaw (+ yaw 1)))
(when (or (key-pressed "d") (key-special-pressed 102)) (set! yaw (- yaw 1)))
(when (or (key-pressed "w") (key-special-pressed 101)) (set! tilt (+ tilt 1)))
(when (or (key-pressed "s") (key-special-pressed 103)) (set! tilt (- tilt 1)))
; clamp tilt to prevent gimbal lock
(when (> tilt 88) (set! tilt 88))