started on nice title.

This commit is contained in:
2015-07-23 22:43:06 -07:00
parent a37ef97368
commit 564a073bb8
8 changed files with 20 additions and 17 deletions

View File

@@ -37,7 +37,7 @@
s)
(defn center [e]
(assoc e :x (- (/ 1280 2) (/ (.getWidth (:object e)) 2))))
(assoc e :x (- (/ 1280 2) (/ (or (:width e) (.getWidth (:object e))) 2))))
(defscreen title-screen
:on-show
@@ -46,36 +46,39 @@
(utils/setup-viewport screen 1280 960)
(utils/load-settings!)
(let [font (utils/get-font "ego/font.fnt")
start-playing (assoc (label "Begin quest" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 300 :height 64 :origin-x 0 :origin-y 0)
start-playing (assoc (label "Begin quest" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 280 :height 64 :origin-x 0 :origin-y 0)
start-playing (center start-playing)
quit (assoc (label "End quest" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 65 :height 32 :origin-x 0 :origin-y 0)
quit (assoc (label "End quest" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y (- 280 (* 32 5)) :height 32 :origin-x 0 :origin-y 0)
quit (center quit)
music (utils/make-music "intro.ogg")
ui-skin (skin "ui/ui.json")]
ui-skin (skin "ui/ui.json")
]
(label! start-playing :set-alignment Align/center)
(label! quit :set-alignment Align/center)
{:overlay (assoc (texture "title-overlay.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
{:overlay (assoc (texture "title.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
:fade (assoc (texture "black.png")
:scale-x 80
:scale-y 80
:opacity 1.0
:origin-x 0
:origin-y 0)
:toolbox (center (assoc (nine-patch {:region (:object (texture "talk-bg-2.png")) :left 9 :top 9 :right 9 :bottom 9})
:y 90 :width 500 :height 250))
:music-label (-> (label "Music" (style :label font (color 1.0 1.0 1.0 1.0)))
(assoc :x 0 :y 240 :height 32 :origin-x 0 :origin-y 0)
(assoc :x 0 :y (- 280 (* 32 1)) :height 32 :origin-x 0 :origin-y 0)
center)
:music-volume-slider (-> (slider {:min 0 :max 100 :step 1} ui-skin :set-value (:music-volume @utils/settings))
(assoc :x (- (/ 1280 2) 150)
:width 300
:y 195
:y (- 280 (* 32 2))
:hover (skin! ui-skin :get "default-horizontal-hover" Slider$SliderStyle)
:default (skin! ui-skin :get "default-horizontal" Slider$SliderStyle)))
:sound-label (->
(label "FX" (style :label font (color 1.0 1.0 1.0 1.0)))
(assoc :x 0 :y 150 :height 32 :origin-x 0 :origin-y 0)
(assoc :x 0 :y (- 280 (* 32 3)) :height 32 :origin-x 0 :origin-y 0)
center)
@@ -83,7 +86,7 @@
:width 300
:x ( - (/ 1280 2)
150)
:y 105
:y (- 280 (* 32 4))
:hover (skin! ui-skin :get "default-horizontal-hover" Slider$SliderStyle)
:default (skin! ui-skin :get "default-horizontal" Slider$SliderStyle))
:font font
@@ -102,7 +105,7 @@
(let [entities (utils/apply-tweens screen entities (:tweens entities))]
(music! (:music entities) :set-volume (utils/current-music-volume (:volume entities)))
()
(render! screen [(:overlay entities) (:start-playing entities) (:quit entities) (:music-label entities) (:music-volume-slider entities) (:sound-label entities) (:sound-volume-slider entities) (:fade entities) ])
(render! screen [(:overlay entities) (:toolbox entities) (:start-playing entities) (:quit entities) (:music-label entities) (:music-volume-slider entities) (:sound-label entities) (:sound-volume-slider entities) (:fade entities) ])
entities))
:show-screen (fn [entities]