diff --git a/desktop/resources/ui/ui.atlas b/desktop/resources/ui/ui.atlas index b07443fc..56164f7b 100644 --- a/desktop/resources/ui/ui.atlas +++ b/desktop/resources/ui/ui.atlas @@ -1,12 +1,20 @@ ui.png -size: 64,32 +size: 128,64 format: RGBA8888 filter: Nearest,Nearest repeat: none +scroll-slider + rotate: false + xy: 2, 2 + size: 20, 20 + split: 8, 8, 8, 8 + orig: 20, 20 + offset: 0, 0 + index: -1 slider rotate: false - xy: 32, 10 + xy: 98, 36 size: 20, 20 split: 8, 8, 8, 8 orig: 20, 20 @@ -14,15 +22,22 @@ slider index: -1 slider-bar rotate: false - xy: 2, 2 + xy: 68, 28 size: 28, 28 orig: 28, 28 offset: 0, 0 index: -1 slider-bar-hover rotate: false - xy: 2, 2 + xy: 68, 28 size: 28, 28 orig: 28, 28 offset: 0, 0 index: -1 +ui + rotate: false + xy: 2, 24 + size: 64, 32 + orig: 64, 32 + offset: 0, 0 + index: -1 diff --git a/desktop/resources/ui/ui.json b/desktop/resources/ui/ui.json index 83f4bb5a..dc95609b 100644 --- a/desktop/resources/ui/ui.json +++ b/desktop/resources/ui/ui.json @@ -3,4 +3,10 @@ com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: { default-horizontal: { background: slider, knob: slider-bar } default-horizontal-hover: { background: slider, knob: slider-bar-hover } -}} +}, + +com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: { + default: { vScroll: slider, hScrollKnob: scroll-slider, hScroll: slider, vScrollKnob: scroll-slider } +} + +} diff --git a/desktop/resources/ui/ui.png b/desktop/resources/ui/ui.png index 375e475e..86cf2b1f 100644 Binary files a/desktop/resources/ui/ui.png and b/desktop/resources/ui/ui.png differ diff --git a/desktop/src-common/advent/screens/title.clj b/desktop/src-common/advent/screens/title.clj index 373be626..f54eb646 100644 --- a/desktop/src-common/advent/screens/title.clj +++ b/desktop/src-common/advent/screens/title.clj @@ -19,6 +19,7 @@ [com.badlogic.gdx.graphics.g2d TextureRegion] [com.badlogic.gdx.utils.viewport FitViewport] [com.badlogic.gdx.scenes.scene2d.ui Slider$SliderStyle Widget] + [com.badlogic.gdx.scenes.scene2d Group] [play_clj.entities ActorEntity] [com.badlogic.gdx.scenes.scene2d.utils Align NinePatchDrawable] [com.badlogic.gdx Application Audio Files Game Gdx Graphics Input @@ -198,27 +199,36 @@ (every-pred :save #(utils/intersects? % [x y])) (vals entities)))) +(defn saves-table [entities] + (let [make-cell (fn [image] [image :width 142 :pad 4 4 4 4 :height 104]) + make-save-screenshot (fn [[save-name save-screenshot]] + (ActorEntity. (doto (Group. ) + (.addActor (:object (doto (image (utils/get-texture "title/screenshot-backdrop.png")) + (image! :set-width 142) + (image! :set-height 104)))) + (.addActor (:object (doto (image (texture save-screenshot)) + (image! :set-x 8) + (image! :set-y 8) + (image! :set-width 126) + (image! :set-height 88))))))) + save-screenshots (map make-save-screenshot (:saves-list entities)) + grouped-screenshots (->> (partition-all 3 save-screenshots) + (mapcat (fn [group] + (conj (map make-cell group) :row))))] + [(doto (scroll-pane (table grouped-screenshots) + (skin "ui/ui.json")) + (scroll-pane! :set-fade-scroll-bars false)) + :colspan 3 :height 224 :width 482])) + (defn saves-menu [entities] - (make-table (concat [[(make-label "Save Title") :colspan 3 :height 32] - :row - [(scroll-pane (table [[(Group. [(image (utils/get-texture "title/screenshot-backdrop.png")) - (image (utils/get-texture (second (first (:saves-list entities)))))]) :width 142 :pad 4 4 4 4 :height 104] - [(image (utils/get-texture "title/screenshot-backdrop.png")) :width 142 :pad 4 4 4 4 :height 104] - [(image (utils/get-texture "title/screenshot-backdrop.png")) :width 142 :pad 4 4 4 4 :height 104] - :row - [(image (utils/get-texture "title/screenshot-backdrop.png")) :width 142 :pad 4 4 4 4 :height 104] - [(image (utils/get-texture "title/screenshot-backdrop.png")) :width 142 :pad 4 4 4 4 :height 104] - [(image (utils/get-texture "title/screenshot-backdrop.png")) :width 142 :pad 4 4 4 4 :height 104] - :row - [(image (utils/get-texture "title/screenshot-backdrop.png")) :width 142 :pad 4 4 4 4 :height 104] - [(image (utils/get-texture "title/screenshot-backdrop.png")) :width 142 :pad 4 4 4 4 :height 104] - [(image (utils/get-texture "title/screenshot-backdrop.png")) :width 142 :pad 4 4 4 4 :height 104]]) - (style :scroll-pane nil nil nil nil nil)) - :colspan 3 :height 224] - :row - [(ActorEntity. (Widget.)) :width 150] - [(make-button "Back" :key :back) :width 150] - [(make-button "Continue" :key :continue) :width 150]]))) + (make-table [[(make-label "") :colspan 3 :height 32] + :row + (saves-table entities) + + :row + [(ActorEntity. (Widget.)) :width 150] + [(make-button "Back" :key :back) :width 150] + [(make-button "Continue" :key :continue) :width 150]])) (defscreen title-screen