update fullscreen appropriately.

This commit is contained in:
Bryce Covert
2015-11-23 21:10:29 -08:00
parent 8697154240
commit c9ee4b8f70
2 changed files with 23 additions and 29 deletions

View File

@@ -216,31 +216,23 @@
[ (make-button "Back" :key :back) :height 56]])))
(defn settings-menu []
(let [chapters (utils/get-chapters)
chapter-table (table
(mapcat identity
(for [chapter [:chapter-1 :chapter-2 :chapter-3 :chapter-4 :chapter-5]]
[[(doto (make-button (if (chapter chapters)
(saves/chapter-name chapter)
"---")
:chapter (chapter chapters))
(text-button! :set-disabled (nil? (chapter chapters)))) :height 56 :pad-bottom 4 :width 400]
:row])))]
(let [fullscreen-button (make-button "Fullscreen" :key :toggle-fullscreen)]
(make-table [[(make-label "Settings" label-color) :height 32 :pad-bottom 4]
:row
[(make-label "Music" label-color) :height 32 :pad-bottom 4]
:row
[(make-slider (:music-volume @utils/settings) :key :music-volume-slider) :width 240 :pad-bottom 4]
:row
[(make-label "FX" label-color) :height 32 :width 200 :pad-bottom 4]
:row
[(make-slider (:sound-volume @utils/settings) :key :sound-volume-slider) :width 240 :pad-bottom 4]
:row
[(make-button "Fullscreen" :key :toggle-fullscreen) :height 56 :pad-bottom 4 :width 240]
(assoc (make-table [[(make-label "Settings" label-color) :height 32 :pad-bottom 4]
:row
[(make-label "Music" label-color) :height 32 :pad-bottom 4]
:row
[(make-slider (:music-volume @utils/settings) :key :music-volume-slider) :width 240 :pad-bottom 4]
:row
[(make-label "FX" label-color) :height 32 :width 200 :pad-bottom 4]
:row
[(make-slider (:sound-volume @utils/settings) :key :sound-volume-slider) :width 240 :pad-bottom 4]
:row
[fullscreen-button :height 56 :pad-bottom 4 :width 240]
:row
[ (make-button "Back" :key :back) :height 56 :width 240]])))
:row
[ (make-button "Back" :key :back) :height 56 :width 240]])
:fullscreen-button fullscreen-button)))
(defn get-selected-save [entities [x y]]
(first (filter
@@ -385,10 +377,11 @@
entities (fly-balloon screen entities)
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 entities)
(label! (:fullscreen entities) :set-text (if (.isFullscreen Gdx/graphics)
"Fullscreen"
"Windowed")))
(when (:fullscreen-button (:settings-menu entities))
(text-button! (:fullscreen-button (:settings-menu entities))
:set-text (if (.isFullscreen Gdx/graphics)
"Windowed"
"Fullscreen")))
(music! (:music entities) :set-volume (utils/current-music-volume (:volume entities)))

View File

@@ -438,8 +438,9 @@
(doto (.setAccessible true))
(.get Gdx/graphics))) 60))
(on-gl (.setDisplayMode Gdx/graphics 1280 960 false)))
(swap! settings assoc :fullscreen val)
(save-settings!)
(on-gl
(swap! settings assoc :fullscreen val)
(save-settings!))
nil
(catch Exception e
(println e))))