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]]))) [ (make-button "Back" :key :back) :height 56]])))
(defn settings-menu [] (defn settings-menu []
(let [chapters (utils/get-chapters) (let [fullscreen-button (make-button "Fullscreen" :key :toggle-fullscreen)]
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])))]
(make-table [[(make-label "Settings" label-color) :height 32 :pad-bottom 4] (assoc (make-table [[(make-label "Settings" label-color) :height 32 :pad-bottom 4]
:row :row
[(make-label "Music" label-color) :height 32 :pad-bottom 4] [(make-label "Music" label-color) :height 32 :pad-bottom 4]
:row :row
[(make-slider (:music-volume @utils/settings) :key :music-volume-slider) :width 240 :pad-bottom 4] [(make-slider (:music-volume @utils/settings) :key :music-volume-slider) :width 240 :pad-bottom 4]
:row :row
[(make-label "FX" label-color) :height 32 :width 200 :pad-bottom 4] [(make-label "FX" label-color) :height 32 :width 200 :pad-bottom 4]
:row :row
[(make-slider (:sound-volume @utils/settings) :key :sound-volume-slider) :width 240 :pad-bottom 4] [(make-slider (:sound-volume @utils/settings) :key :sound-volume-slider) :width 240 :pad-bottom 4]
:row :row
[(make-button "Fullscreen" :key :toggle-fullscreen) :height 56 :pad-bottom 4 :width 240] [fullscreen-button :height 56 :pad-bottom 4 :width 240]
:row :row
[ (make-button "Back" :key :back) :height 56 :width 240]]))) [ (make-button "Back" :key :back) :height 56 :width 240]])
:fullscreen-button fullscreen-button)))
(defn get-selected-save [entities [x y]] (defn get-selected-save [entities [x y]]
(first (filter (first (filter
@@ -385,10 +377,11 @@
entities (fly-balloon screen entities) entities (fly-balloon screen entities)
entities (update-in entities [:balloon] merge (animation->texture screen (:anim (:balloon 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))))] entities (update-in entities [:banner-back] merge (animation->texture screen (:anim (:banner-back entities))))]
(when (:fullscreen entities) (when (:fullscreen-button (:settings-menu entities))
(label! (:fullscreen entities) :set-text (if (.isFullscreen Gdx/graphics) (text-button! (:fullscreen-button (:settings-menu entities))
"Fullscreen" :set-text (if (.isFullscreen Gdx/graphics)
"Windowed"))) "Windowed"
"Fullscreen")))
(music! (:music entities) :set-volume (utils/current-music-volume (:volume entities))) (music! (:music entities) :set-volume (utils/current-music-volume (:volume entities)))

View File

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