more progress on ui scaling.

This commit is contained in:
Bryce Covert
2016-10-15 17:41:03 -07:00
parent 2f831bb4b2
commit 85945b7fa6
3 changed files with 78 additions and 48 deletions

View File

@@ -134,7 +134,7 @@
(defn button-style []
(let [^TextButton$TextButtonStyle style (skin! (skin "ui/ui.json") :get TextButton$TextButtonStyle)
tx (-> style .font .getRegion .getTexture)]
(-> style .font .getData (.setScale 0.5))
(-> style .font .getData (.setScale 1.0))
(call! ^Texture tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)
style))
@@ -161,7 +161,7 @@
(defn make-checkbox
([msg checked & rest]
(let [s (skin! (skin "ui/ui.json") :get CheckBox$CheckBoxStyle)]
(-> s .font .getData (.setScale 0.25))
(-> s .font .getData (.setScale 0.5))
(doto (merge (check-box msg s)
(apply hash-map rest))
(set-checkbox-state checked)
@@ -178,7 +178,7 @@
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)]
(-> style .font .getData (.setScale 0.25))
(-> style .font .getData (.setScale 0.5))
(-> msg
(label style)
(assoc :x 0 :y 0 :height 40 :origin-x 0 :origin-y 0 :z 8)
@@ -207,30 +207,30 @@
(table)
(doto (table! :set-background (NinePatchDrawable. (skin! (skin "ui/ui.json") :get-patch "ui-bg" ))))
(assoc
:y 32 :width 504 :height 335
:x (- (/ 1280 2) (/ 504 2))
:y 32 :width (* utils/ui-scale 504) :height (* utils/ui-scale 335)
:x (- (/ 1280 2) (/ (* utils/ui-scale 504) 2))
:z 8
:opacity 1.0)))
(defn main-menu [screen]
(let [start-playing-label (quest-label)
is-starting? (= "Begin Quest" start-playing-label)]
(make-table [[(make-button start-playing-label :key :continue-or-start) :height 56 :pad-bottom 4 :width 250]
(make-table [[(make-button start-playing-label :key :continue-or-start) :height (* utils/ui-scale 56) :pad-bottom 4 :width (* utils/ui-scale 250)]
:row
[(doto (make-button "Load" :key :load)
(text-button! :set-disabled (not (seq (utils/snapshot-list))))) :height 56 :pad-bottom 4 :width 250]
(text-button! :set-disabled (not (seq (utils/snapshot-list))))) :height (* utils/ui-scale 56) :pad-bottom 4 :width (* utils/ui-scale 250)]
:row
[(doto (make-button "Chapters" :key :chapters)
(text-button! :set-disabled (not (->> (utils/get-chapters)
(vals)
(filter identity)
seq)))) :height 56 :pad-bottom 4 :width 250]
seq)))) :height (* utils/ui-scale 56) :pad-bottom 4 :width (* utils/ui-scale 250)]
:row
[(make-button "Settings" :key :settings) :height 56 :pad-bottom 4 :width 250]
[(make-button "Settings" :key :settings) :height (* utils/ui-scale 56) :pad-bottom 4 :width (* utils/ui-scale 250)]
:row
[(make-button "End Quest" :key :end-quest) :height 56 :width 250]
[(make-button "End Quest" :key :end-quest) :height (* utils/ui-scale 56) :width (* utils/ui-scale 250)]
])))
(defn chapters-menu []