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

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 689 B

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