Move all listeners into core so they can be made private
This commit is contained in:
@@ -9,10 +9,8 @@
|
||||
HorizontalGroup Image ImageButton ImageTextButton Label ScrollPane
|
||||
SelectBox Skin Slider Stack Table TextButton TextField Tree
|
||||
Tree$Node VerticalGroup WidgetGroup Window]
|
||||
[com.badlogic.gdx.scenes.scene2d.utils ActorGestureListener Align
|
||||
ChangeListener ClickListener DragListener FocusListener
|
||||
NinePatchDrawable SpriteDrawable TextureRegionDrawable
|
||||
TiledDrawable]
|
||||
[com.badlogic.gdx.scenes.scene2d.utils NinePatchDrawable
|
||||
SpriteDrawable TextureRegionDrawable TiledDrawable]
|
||||
[com.esotericsoftware.tablelayout Cell]))
|
||||
|
||||
(defmacro drawable
|
||||
@@ -394,92 +392,3 @@
|
||||
(defmacro window!
|
||||
[entity k & options]
|
||||
`(u/call! ^Window (:object ~entity) ~k ~@options))
|
||||
|
||||
; listeners
|
||||
|
||||
(defn ^:private gesture-listener
|
||||
[{:keys [on-ui-fling on-ui-long-press on-ui-pan on-ui-pinch
|
||||
on-ui-tap on-ui-touch-down on-ui-touch-up on-ui-zoom]}
|
||||
execute-fn!]
|
||||
(proxy [ActorGestureListener] []
|
||||
(fling [e vx vy b]
|
||||
(execute-fn! on-ui-fling
|
||||
:event e :velocity-x vx :velocity-y vy :button b))
|
||||
(longPress [a x y]
|
||||
(execute-fn! on-ui-long-press :actor a :x x :y y)
|
||||
false)
|
||||
(pan [e x y dx dy]
|
||||
(execute-fn! on-ui-pan :event e :x x :y y :delta-x dx :delta-y dy))
|
||||
(pinch [e ip1 ip2 p1 p2]
|
||||
(execute-fn! on-ui-pinch
|
||||
:event e :initial-pointer-1 ip1 :initial-pointer-2 ip2
|
||||
:pointer1 p1 :pointer2 p2))
|
||||
(tap [e x y p b]
|
||||
(execute-fn! on-ui-tap :event e :x x :y y :pointer p :button b))
|
||||
(touchDown [e x y p b]
|
||||
(execute-fn! on-ui-touch-down :event e :x x :y y :pointer p :button b))
|
||||
(touchUp [e x y p b]
|
||||
(execute-fn! on-ui-touch-up :event e :x x :y y :pointer p :button b))
|
||||
(zoom [e id d]
|
||||
(execute-fn! on-ui-zoom :event e :initial-distance id :distance d))))
|
||||
|
||||
(defn ^:private change-listener
|
||||
[{:keys [on-ui-changed]} execute-fn!]
|
||||
(proxy [ChangeListener] []
|
||||
(changed [e a]
|
||||
(execute-fn! on-ui-changed :event e :actor a))))
|
||||
|
||||
(defn ^:private click-listener
|
||||
[{:keys [on-ui-clicked on-ui-enter on-ui-exit
|
||||
on-ui-touch-down on-ui-touch-dragged on-ui-touch-up]}
|
||||
execute-fn!]
|
||||
(proxy [ClickListener] []
|
||||
(clicked [e x y]
|
||||
(execute-fn! on-ui-clicked :event e :x x :y y))
|
||||
(enter [e x y p a]
|
||||
(execute-fn! on-ui-enter :event e :x x :y y :pointer p :from-actor a))
|
||||
(exit [e x y p a]
|
||||
(execute-fn! on-ui-exit :event e :x x :y y :pointer p :to-actor a))
|
||||
(touchDown [e x y p b]
|
||||
(execute-fn! on-ui-touch-down :event e :x x :y y :pointer p :button b)
|
||||
false)
|
||||
(touchDragged [e x y p]
|
||||
(execute-fn! on-ui-touch-dragged :event e :x x :y y :pointer p))
|
||||
(touchUp [e x y p b]
|
||||
(execute-fn! on-ui-touch-up :event e :x x :y y :pointer p :button b))))
|
||||
|
||||
(defn ^:private drag-listener
|
||||
[{:keys [on-ui-drag on-ui-drag-start on-ui-drag-stop
|
||||
on-ui-touch-down on-ui-touch-dragged on-ui-touch-up]}
|
||||
execute-fn!]
|
||||
(proxy [DragListener] []
|
||||
(touchDown [e x y p b]
|
||||
(execute-fn! on-ui-touch-down :event e :x x :y y :pointer p :button b)
|
||||
false)
|
||||
(touchDragged [e x y p]
|
||||
(execute-fn! on-ui-touch-dragged :event e :x x :y y :pointer p))
|
||||
(touchUp [e x y p b]
|
||||
(execute-fn! on-ui-touch-up :event e :x x :y y :pointer p :button b))
|
||||
(drag [e x y p]
|
||||
(execute-fn! on-ui-drag :event e :x x :y y :pointer p))
|
||||
(dragStart [e x y p]
|
||||
(execute-fn! on-ui-drag-start :event e :x x :y y :pointer p))
|
||||
(dragStop [e x y p]
|
||||
(execute-fn! on-ui-drag-stop :event e :x x :y y :pointer p))))
|
||||
|
||||
(defn ^:private focus-listener
|
||||
[{:keys [on-ui-keyboard-focus-changed on-ui-scroll-focus-changed]}
|
||||
execute-fn!]
|
||||
(proxy [FocusListener] []
|
||||
(keyboardFocusChanged [e a f]
|
||||
(execute-fn! on-ui-keyboard-focus-changed :event e :actor a :focused? f))
|
||||
(scrollFocusChanged [e a f]
|
||||
(execute-fn! on-ui-scroll-focus-changed :event e :actor a :focused? f))))
|
||||
|
||||
(defn ui-listeners
|
||||
[options execute-fn!]
|
||||
[(gesture-listener options execute-fn!)
|
||||
(change-listener options execute-fn!)
|
||||
(click-listener options execute-fn!)
|
||||
(drag-listener options execute-fn!)
|
||||
(focus-listener options execute-fn!)])
|
||||
|
||||
Reference in New Issue
Block a user