Clean up execution function

This commit is contained in:
oakes
2014-01-10 14:21:37 -05:00
parent 5657b6e9b1
commit f2a1078167
2 changed files with 33 additions and 43 deletions

View File

@@ -51,28 +51,28 @@
execute-fn!]
(reify InputProcessor
(keyDown [this k]
(execute-fn! key-down {:keycode k})
(execute-fn! key-down :keycode k)
false)
(keyTyped [this c]
(execute-fn! key-typed {:character c})
(execute-fn! key-typed :character c)
false)
(keyUp [this k]
(execute-fn! key-up {:keycode k})
(execute-fn! key-up :keycode k)
false)
(mouseMoved [this sx sy]
(execute-fn! mouse-moved {:screen-x sx :screen-y sy})
(execute-fn! mouse-moved :screen-x sx :screen-y sy)
false)
(scrolled [this a]
(execute-fn! scrolled {:amount a})
(execute-fn! scrolled :amount a)
false)
(touchDown [this sx sy p b]
(execute-fn! touch-down {:screen-x sx :screen-y sy :pointer p :button b})
(execute-fn! touch-down :screen-x sx :screen-y sy :pointer p :button b)
false)
(touchDragged [this sx sy p]
(execute-fn! touch-dragged {:screen-x sx :screen-y sy :pointer p})
(execute-fn! touch-dragged :screen-x sx :screen-y sy :pointer p)
false)
(touchUp [this sx sy p b]
(execute-fn! touch-up {:screen-x sx :screen-y sy :pointer p :button b})
(execute-fn! touch-up :screen-x sx :screen-y sy :pointer p :button b)
false)))
(defmacro input
@@ -87,28 +87,29 @@
(let [listener
(reify GestureDetector$GestureListener
(fling [this vx vy b]
(execute-fn! fling {:velocity-x vx :velocity-y vy :button b})
(execute-fn! fling :velocity-x vx :velocity-y vy :button b)
false)
(longPress [this x y]
(execute-fn! long-press {:x x :y y})
(execute-fn! long-press :x x :y y)
false)
(pan [this x y dx dy]
(execute-fn! pan {:x x :y y :delta-x dx :delta-y dy})
(execute-fn! pan :x x :y y :delta-x dx :delta-y dy)
false)
(panStop [this x y p b]
(execute-fn! pan-stop {:x x :y y :pointer p :button b})
(execute-fn! pan-stop :x x :y y :pointer p :button b)
false)
(pinch [this ip1 ip2 p1 p2]
(execute-fn! pinch {:initial-pointer-1 ip1 :initial-pointer-2 ip2
:pointer1 p1 :pointer2 p2})
(execute-fn! pinch
:initial-pointer-1 ip1 :initial-pointer-2 ip2
:pointer1 p1 :pointer2 p2)
false)
(tap [this x y c b]
(execute-fn! tap {:x x :y y :count c :button b})
(execute-fn! tap :x x :y y :count c :button b)
false)
(touchDown [this x y p b]
false)
(zoom [this id d]
(execute-fn! zoom {:initial-distance id :distance d})
(execute-fn! zoom :initial-distance id :distance d)
false))]
(proxy [GestureDetector] [listener])))