not sure why I didn't think of this sooner.
This commit is contained in:
@@ -6,7 +6,7 @@ filter: Nearest,Nearest
|
||||
repeat: none
|
||||
button
|
||||
rotate: false
|
||||
xy: 2, 6
|
||||
xy: 2, 10
|
||||
size: 52, 52
|
||||
split: 24, 24, 12, 22
|
||||
orig: 52, 52
|
||||
@@ -14,7 +14,7 @@ button
|
||||
index: -1
|
||||
button.disabled
|
||||
rotate: false
|
||||
xy: 56, 6
|
||||
xy: 56, 10
|
||||
size: 52, 52
|
||||
split: 24, 24, 12, 22
|
||||
orig: 52, 52
|
||||
@@ -22,7 +22,7 @@ button.disabled
|
||||
index: -1
|
||||
button.hover
|
||||
rotate: false
|
||||
xy: 110, 6
|
||||
xy: 110, 10
|
||||
size: 52, 52
|
||||
split: 24, 24, 12, 22
|
||||
orig: 52, 52
|
||||
@@ -30,15 +30,29 @@ button.hover
|
||||
index: -1
|
||||
button.pressed
|
||||
rotate: false
|
||||
xy: 164, 6
|
||||
xy: 164, 10
|
||||
size: 52, 52
|
||||
split: 24, 24, 16, 16
|
||||
orig: 52, 52
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
checkbox
|
||||
rotate: false
|
||||
xy: 264, 2
|
||||
size: 42, 60
|
||||
orig: 42, 60
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
checkbox.on
|
||||
rotate: false
|
||||
xy: 308, 2
|
||||
size: 42, 60
|
||||
orig: 42, 60
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
screenshot-image-button
|
||||
rotate: false
|
||||
xy: 368, 38
|
||||
xy: 456, 42
|
||||
size: 20, 20
|
||||
split: 8, 8, 8, 8
|
||||
orig: 20, 20
|
||||
@@ -46,7 +60,7 @@ screenshot-image-button
|
||||
index: -1
|
||||
screenshot-image-button-active
|
||||
rotate: false
|
||||
xy: 346, 38
|
||||
xy: 434, 42
|
||||
size: 20, 20
|
||||
split: 8, 8, 8, 8
|
||||
orig: 20, 20
|
||||
@@ -54,7 +68,7 @@ screenshot-image-button-active
|
||||
index: -1
|
||||
scroll-slider
|
||||
rotate: false
|
||||
xy: 264, 10
|
||||
xy: 352, 14
|
||||
size: 20, 48
|
||||
split: 8, 8, 12, 12
|
||||
orig: 20, 48
|
||||
@@ -62,7 +76,7 @@ scroll-slider
|
||||
index: -1
|
||||
slider
|
||||
rotate: false
|
||||
xy: 390, 38
|
||||
xy: 478, 42
|
||||
size: 20, 20
|
||||
split: 8, 8, 8, 8
|
||||
orig: 20, 20
|
||||
@@ -70,21 +84,21 @@ slider
|
||||
index: -1
|
||||
slider-bar
|
||||
rotate: false
|
||||
xy: 286, 30
|
||||
xy: 374, 34
|
||||
size: 28, 28
|
||||
orig: 28, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
slider-bar-hover
|
||||
rotate: false
|
||||
xy: 316, 30
|
||||
xy: 404, 34
|
||||
size: 28, 28
|
||||
orig: 28, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
ui-bg
|
||||
rotate: false
|
||||
xy: 218, 2
|
||||
xy: 218, 6
|
||||
size: 44, 56
|
||||
split: 20, 21, 16, 16
|
||||
orig: 44, 56
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
{
|
||||
com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: ego/font.fnt }, button-font: { file: ego/button-font.fnt }}
|
||||
com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: ego/font.fnt, scale: 0.5 }, button-font: { file: ego/button-font.fnt }}
|
||||
com.badlogic.gdx.graphics.Color: {
|
||||
button-font-up: {hex: 19003Dff },
|
||||
gray: {hex: 21172Eff },
|
||||
pressed: { hex: 19003Dff },
|
||||
yellow: {hex: 69386Dff },
|
||||
label-yellow: {hex: ce7f00ff },
|
||||
label-yellow-hover: {hex: de9827ff } ,
|
||||
label-yellow-down: {hex: a26d17ff }
|
||||
},
|
||||
com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
|
||||
default: { font: default-font, downFontColor: label-yellow-down, overFontColor: label-yellow-hover, fontColor: label-yellow, checkboxOn: checkbox.on, checkboxOff: checkbox, unpressedOffsetY: 12, pressedOffsetY: 12 }
|
||||
},
|
||||
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
|
||||
default-horizontal: { background: slider, knob: slider-bar }
|
||||
default-horizontal-hover: { background: slider, knob: slider-bar-hover }
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.7 KiB |
@@ -96,8 +96,7 @@
|
||||
|
||||
(when (:shown? entities)
|
||||
(doto (:highlighted-text entities)
|
||||
(label! :set-color (color 1 1 1 opacity))
|
||||
(label! :set-font-scale 0.5))
|
||||
(label! :set-color (color 1 1 1 opacity)))
|
||||
(render! screen [(:fade entities) (:overlay entities)])
|
||||
(render! screen (:items entities))
|
||||
(if-let [item (:highlighted-item entities)]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion]
|
||||
[play_clj.entities NinePatchEntity]
|
||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||
[com.badlogic.gdx.scenes.scene2d.ui Slider$SliderStyle Widget ButtonGroup TextButton$TextButtonStyle]
|
||||
[com.badlogic.gdx.scenes.scene2d.ui Slider$SliderStyle Widget ButtonGroup TextButton$TextButtonStyle CheckBox$CheckBoxStyle CheckBox Button]
|
||||
[com.badlogic.gdx.scenes.scene2d Group Actor]
|
||||
[play_clj.entities ActorEntity]
|
||||
[com.badlogic.gdx.scenes.scene2d.utils Align NinePatchDrawable TextureRegionDrawable]
|
||||
@@ -145,6 +145,26 @@
|
||||
|
||||
(doto button save-object ))))
|
||||
|
||||
|
||||
(defn set-checkbox-state [cb state]
|
||||
(-> Button
|
||||
(.getDeclaredField (name "isChecked"))
|
||||
(doto (.setAccessible true))
|
||||
(.set (:object cb) state))
|
||||
cb)
|
||||
|
||||
(defn make-checkbox
|
||||
([msg checked & rest]
|
||||
(let [s (skin! (skin "ui/ui.json") :get CheckBox$CheckBoxStyle)]
|
||||
(-> s
|
||||
.font
|
||||
(.setScale 0.5 0.5))
|
||||
|
||||
(doto (merge (check-box msg s)
|
||||
(apply hash-map rest))
|
||||
(set-checkbox-state (utils/is-fullscreen?))
|
||||
save-object))))
|
||||
|
||||
(defn make-label
|
||||
([msg]
|
||||
(make-label msg nil))
|
||||
@@ -161,8 +181,8 @@
|
||||
(label style)
|
||||
(assoc :x 0 :y 0 :height 40 :origin-x 0 :origin-y 0 :z 8)
|
||||
(doto (label! :set-alignment Align/bottom)
|
||||
(label! :set-font-scale 0.5)
|
||||
(#(label! % :set-width (/ (label! % :get-width) 2))))
|
||||
#_(label! :set-font-scale 0.5)
|
||||
#_(#(label! % :set-width (/ (label! % :get-width) 2))))
|
||||
center))))
|
||||
|
||||
(defn make-slider [initial-value & rest]
|
||||
@@ -230,11 +250,9 @@
|
||||
[ (make-button "Back" :key :back) :height 56]])))
|
||||
|
||||
(defn settings-menu []
|
||||
(let [fullscreen-button (make-button "Fullscreen" :key :toggle-fullscreen)]
|
||||
(let [fullscreen-button (make-checkbox "Fullscreen" (utils/is-fullscreen?) :key :toggle-fullscreen)]
|
||||
|
||||
(assoc (make-table [[(make-label "Settings" label-color) :height 40 :pad-bottom 4]
|
||||
:row
|
||||
[(make-label "Music" label-color) :height 40 :pad-bottom 4]
|
||||
(assoc (make-table [[(make-label "Music" label-color) :height 40 :pad-bottom 4]
|
||||
:row
|
||||
[(make-slider (:music-volume @utils/settings) :key :music-volume-slider) :width 240 :pad-bottom 4]
|
||||
:row
|
||||
@@ -394,10 +412,7 @@
|
||||
entities (update-in entities [:balloon] merge (animation->texture screen (:anim (:balloon entities))))
|
||||
entities (update-in entities [:banner-back] merge (animation->texture screen (:anim (:banner-back entities))))]
|
||||
(when (:fullscreen-button (:settings-menu entities))
|
||||
(text-button! (:fullscreen-button (:settings-menu entities))
|
||||
:set-text (if (utils/is-fullscreen?)
|
||||
"Windowed"
|
||||
"Fullscreen")))
|
||||
(set-checkbox-state (:fullscreen-button (:settings-menu entities)) (utils/is-fullscreen?)))
|
||||
|
||||
|
||||
(music! (:music entities) :set-volume (utils/current-music-volume (:volume entities)))
|
||||
|
||||
@@ -150,7 +150,8 @@
|
||||
edn/read-string)))
|
||||
|
||||
(defn get-font [filename]
|
||||
(let [font (bitmap-font filename)
|
||||
(let [font (-> (bitmap-font filename)
|
||||
(doto (bitmap-font! :set-scale 0.5 0.5)))
|
||||
tr (bitmap-font! font :get-region)
|
||||
tx (.getTexture tr)]
|
||||
(call! ^Texture tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)
|
||||
|
||||
Reference in New Issue
Block a user