diff --git a/desktop/src-common/advent/screens/title.clj b/desktop/src-common/advent/screens/title.clj index 06e031cd..3130eb4c 100644 --- a/desktop/src-common/advent/screens/title.clj +++ b/desktop/src-common/advent/screens/title.clj @@ -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))) diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index 1b3c6fdc..05e07451 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -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))))