added scrollbars.

This commit is contained in:
Bryce Covert
2015-11-04 09:26:00 -08:00
parent fadb1fcdcf
commit 218d4f8e0e
4 changed files with 56 additions and 25 deletions

View File

@@ -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