a lot of stuff to get rid of reflection.

This commit is contained in:
Bryce Covert
2016-08-03 20:32:03 -07:00
parent 197165b663
commit 3d69fc0b65
13 changed files with 86 additions and 88 deletions

View File

@@ -20,11 +20,11 @@
[advent.version]
)
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter Color]
[com.badlogic.gdx.graphics.g2d TextureRegion]
[com.badlogic.gdx.graphics.g2d TextureRegion NinePatch]
[play_clj.entities NinePatchEntity]
[com.badlogic.gdx.utils.viewport FitViewport]
[com.badlogic.gdx.scenes.scene2d.ui Slider$SliderStyle Widget ButtonGroup TextButton$TextButtonStyle CheckBox$CheckBoxStyle CheckBox Button]
[com.badlogic.gdx.scenes.scene2d Group Actor]
[com.badlogic.gdx.scenes.scene2d.ui Slider$SliderStyle Widget ButtonGroup TextButton$TextButtonStyle CheckBox$CheckBoxStyle CheckBox Button ImageButton ScrollPane]
[com.badlogic.gdx.scenes.scene2d Group Actor Stage]
[play_clj.entities ActorEntity]
[com.badlogic.gdx.utils Align]
[com.badlogic.gdx.scenes.scene2d.utils NinePatchDrawable TextureRegionDrawable BaseDrawable]
@@ -54,12 +54,12 @@
(defn style-slider [s mouse-pos]
(if (utils/intersects? s mouse-pos)
(slider! s :set-style (:hover s))
(slider! s :set-style (:default s)))
(slider! s :set-style ^Slider$SliderStyle (:hover s))
(slider! s :set-style ^Slider$SliderStyle (:default s)))
s)
(defn center [e]
(assoc e :x (- (/ 1280 2) (/ (or (:width e) (.getWidth (:object e))) 2))))
(assoc e :x (- (/ 1280 2) (/ (or (:width e) (.getWidth ^Actor (:object e))) 2))))
(defn get-dir [old-x new-x]
@@ -132,7 +132,7 @@
(tween/tween :fade-out-music screen [:volume] 1.0 0.0 1.0)))))
(defn button-style []
(let [style (skin! (skin "ui/ui.json") :get TextButton$TextButtonStyle)
(let [^TextButton$TextButtonStyle style (skin! (skin "ui/ui.json") :get TextButton$TextButtonStyle)
tx (-> style .font .getRegion .getTexture)]
(call! ^Texture tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)
@@ -160,10 +160,6 @@
(defn make-checkbox
([msg checked & rest]
(let [s (skin! (skin "ui/ui.json") :get CheckBox$CheckBoxStyle)]
(-> s
.font
)
(doto (merge (check-box msg s)
(apply hash-map rest))
(set-checkbox-state checked)
@@ -177,7 +173,7 @@
p (NinePatchEntity. (skin! (skin "ui/ui.json") :get-patch "ui-bg"))
_ (nine-patch! p :set-padding 0 0 0 0)
bg (drawable :nine-patch (:object p))
bg (drawable :nine-patch ^NinePatch (:object p))
style (style :label font (or col (color 1.0 0.3 0.3 1.0)))
#_#__ (set! (.background style) bg)]
(-> msg
@@ -277,7 +273,7 @@
(every-pred :save #(utils/intersects? % [x y]))
(vals entities))))
(defn saves-table [entities stage]
(defn saves-table [entities ^Stage stage]
(let [group (doto (ButtonGroup.)
(.setMaxCheckCount 1)
(.setMinCheckCount 0)
@@ -299,7 +295,7 @@
))
save-object)]
(.add group (:object btn))
(.add group ^ImageButton (:object btn))
(ActorEntity. (:object btn))))
save-screenshots (map make-save-screenshot (:saves-list entities))
grouped-screenshots (->> (partition-all 2 save-screenshots)
@@ -308,7 +304,7 @@
scroll-pane (doto (scroll-pane (table grouped-screenshots)
(skin "ui/ui.json"))
(scroll-pane! :set-fade-scroll-bars false))]
(.setScrollFocus stage (:object scroll-pane))
(.setScrollFocus stage ^ScrollPane (:object scroll-pane))
[scroll-pane
:colspan 3 :height 190 :pad-bottom 4 :width 472]))
@@ -444,7 +440,7 @@
:on-ui-changed
(fn [{:keys [actor] :as screen} [entities]]
(fn [{:keys [^Actor actor] :as screen} [entities]]
(when-not (get-in entities [:tweens :fade-out])
(let [e (-> actor .getUserObject)
actor-key (:key e)]
@@ -554,6 +550,6 @@
:else
entities))))
:on-resize (fn [{:keys [viewport width height]} [entities]]
:on-resize (fn [{:keys [^FitViewport viewport width height]} [entities]]
(.update viewport width height false)
nil))