Start transitioning :keycode to :key so it is consistent with :button

This commit is contained in:
oakes
2014-05-09 20:42:17 -04:00
parent ccbc2f4db3
commit a1f269a0bf
2 changed files with 4 additions and 4 deletions

View File

@@ -133,7 +133,7 @@ via the screen map.
(defscreen my-screen (defscreen my-screen
:on-key-down ; a key was pressed :on-key-down ; a key was pressed
(fn [screen entities] (fn [screen entities]
(println (:keycode screen)) ; the code of the key (see key-code) (println (:key screen)) ; the code of the key (see key-code)
entities) entities)
:on-key-typed ; a key was typed :on-key-typed ; a key was typed
(fn [screen entities] (fn [screen entities]
@@ -141,7 +141,7 @@ via the screen map.
entities) entities)
:on-key-up ; a key was released :on-key-up ; a key was released
(fn [screen entities] (fn [screen entities]
(println (:keycode screen)) ; the code of the key (see key-code) (println (:key screen)) ; the code of the key (see key-code)
entities) entities)
:on-mouse-moved ; the mouse was moved without pressing any buttons :on-mouse-moved ; the mouse was moved without pressing any buttons
(fn [screen entities] (fn [screen entities]

View File

@@ -8,13 +8,13 @@
execute-fn!] execute-fn!]
(reify InputProcessor (reify InputProcessor
(keyDown [this k] (keyDown [this k]
(execute-fn! on-key-down :keycode k) (execute-fn! on-key-down :key k :keycode k)
false) false)
(keyTyped [this c] (keyTyped [this c]
(execute-fn! on-key-typed :character c) (execute-fn! on-key-typed :character c)
false) false)
(keyUp [this k] (keyUp [this k]
(execute-fn! on-key-up :keycode k) (execute-fn! on-key-up :key k :keycode k)
false) false)
(mouseMoved [this sx sy] (mouseMoved [this sx sy]
(execute-fn! on-mouse-moved :input-x sx :input-y sy) (execute-fn! on-mouse-moved :input-x sx :input-y sy)