splash works.
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
|
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
|
||||||
:omit-source true
|
:omit-source true
|
||||||
:aliases {"pack" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "asset-work/" "resources/packed/"]
|
:aliases {"pack" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "asset-work/" "resources/packed/"]
|
||||||
|
"pack-pop" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker"
|
||||||
|
"/Users/brycecovert/Documents/POPPixelLogo_Pack/POPPixelLogo2_PNG/processed" "resources/packed-pop-logo/"]
|
||||||
"pack-font" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "resources/font-pack/" "resources/font-pack/packed/"]
|
"pack-font" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "resources/font-pack/" "resources/font-pack/packed/"]
|
||||||
"script" ["run" "-m" "advent.analyze/dump-speech"]}
|
"script" ["run" "-m" "advent.analyze/dump-speech"]}
|
||||||
:profiles {
|
:profiles {
|
||||||
|
|||||||
@@ -25,16 +25,30 @@
|
|||||||
|
|
||||||
(defn fade-in [screen e thing then]
|
(defn fade-in [screen e thing then]
|
||||||
(assoc-in e [:tweens :fade-in]
|
(assoc-in e [:tweens :fade-in]
|
||||||
(tween/tween :fade-in screen [thing :opacity] 0.0 1.0 2.0
|
(tween/tween :fade-in screen [thing :opacity] 0.0 1.0 5.0
|
||||||
:finish then
|
:finish then
|
||||||
:ease tween/ease-in-quadratic)))
|
:ease tween/ease-in-quadratic)))
|
||||||
|
|
||||||
(defn fade-out [screen e thing then]
|
(defn fade-out [screen e thing then]
|
||||||
(assoc-in e [:tweens :fade-out]
|
(assoc-in e [:tweens :fade-out]
|
||||||
(tween/tween :fade-out screen [thing :opacity] 1.0 0.0 2.0
|
(tween/tween :fade-out screen [thing :opacity] 1.0 0.0 5.0
|
||||||
:finish then
|
:finish then
|
||||||
:ease tween/ease-in-quadratic)))
|
:ease tween/ease-in-quadratic)))
|
||||||
|
|
||||||
|
(defn get-texture [path]
|
||||||
|
(let [atlas-name (str/replace path #".png" "")
|
||||||
|
atlas (texture-atlas "packed-pop-logo/pack.atlas")]
|
||||||
|
(texture (texture-atlas! atlas :find-region atlas-name))))
|
||||||
|
|
||||||
|
(defn make-anim-seq [file [w h] speed frames]
|
||||||
|
(animation speed (map #(get-texture (str file "_" (inc %) ".png")) frames)))
|
||||||
|
|
||||||
|
(defn animate [entity screen]
|
||||||
|
(if (:anim entity)
|
||||||
|
(merge entity (animation->texture (update-in screen [:total-time] #(- (or % 0) (:anim-start entity 0))) (:anim entity)))
|
||||||
|
entity))
|
||||||
|
|
||||||
|
|
||||||
(defscreen splash-screen
|
(defscreen splash-screen
|
||||||
:on-show
|
:on-show
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -43,26 +57,35 @@
|
|||||||
|
|
||||||
(input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
(input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
||||||
|
|
||||||
(let [entities {:background (assoc (utils/get-texture "black.png")
|
(let [screen (assoc screen :total-time 0)
|
||||||
|
pop-anim (make-anim-seq "POPPixelLogo_02" [320 240] 0.05 (range 200))
|
||||||
|
entities {:background (assoc (utils/get-texture "black.png")
|
||||||
:scale-x 80
|
:scale-x 80
|
||||||
:scale-y 80
|
:scale-y 80
|
||||||
:opacity 1.0
|
:opacity 1.0
|
||||||
:origin-x 0
|
:origin-x 0
|
||||||
:origin-y 0
|
:origin-y 0
|
||||||
:z 0)
|
:z 0)
|
||||||
:poslogo (assoc (utils/get-texture "pos.png") :x 640 :y 480 :scale-x 2 :scale-y 2 :origin-x 145 :origin-y 64 :z 1 :opacity 0.0)
|
:pop-logo (assoc (animation->texture screen pop-anim)
|
||||||
:dbhlogo (assoc (utils/get-texture "dbh.png") :x 0 :y 0 :origin-x 0 :origin-y 0 :z 1 :opacity 0.0)
|
:main-anim pop-anim
|
||||||
}]
|
:x 0 :y 0
|
||||||
|
:origin-x 0 :origin-y 0
|
||||||
|
:scale-x 4 :scale-y 4
|
||||||
|
:z 1)
|
||||||
|
:dbhlogo (assoc (utils/get-texture "dbh.png") :x 0 :y 0 :origin-x 0 :origin-y 0 :z 1 :opacity 0.0)}]
|
||||||
(fade-in screen entities :dbhlogo
|
(fade-in screen entities :dbhlogo
|
||||||
(fn [entities]
|
(fn [entities]
|
||||||
(fade-out (assoc-in screen [:total-time] 2.0) entities :dbhlogo
|
(fade-out (assoc-in screen [:total-time] 5.0) entities :dbhlogo
|
||||||
(fn [entities]
|
(fn [entities]
|
||||||
(fade-in (assoc-in screen [:total-time] 4.0) entities :poslogo
|
(as-> entities entities
|
||||||
(fn [entities]
|
(assoc-in entities [:pop-logo :anim-start ] 10.0)
|
||||||
(fade-out (assoc-in screen [:total-time] 6.0) entities :poslogo
|
(assoc-in entities [:pop-logo :anim] (get-in entities [:pop-logo :main-anim]))
|
||||||
(fn [entities]
|
(fade-in (assoc-in screen [:total-time] 10.0) entities :pop-logo
|
||||||
(set-screen! @(resolve 'advent.core/advent) title/title-screen)
|
(fn [entities]
|
||||||
entities))))))))))
|
(fade-out (assoc-in screen [:total-time] 15.0) entities :pop-logo
|
||||||
|
(fn [entities]
|
||||||
|
(set-screen! @(resolve 'advent.core/advent) title/title-screen)
|
||||||
|
entities)))))))))))
|
||||||
|
|
||||||
|
|
||||||
:on-render
|
:on-render
|
||||||
@@ -70,7 +93,8 @@
|
|||||||
(steam/update)
|
(steam/update)
|
||||||
(.apply viewport)
|
(.apply viewport)
|
||||||
(clear!)
|
(clear!)
|
||||||
(let [entities (utils/apply-tweens screen entities (:tweens entities))]
|
(let [entities (utils/apply-tweens screen entities (:tweens entities))
|
||||||
|
entities (update-in entities [:pop-logo] animate screen)]
|
||||||
(render! screen (sort-by :z (filter :object (vals entities))) )
|
(render! screen (sort-by :z (filter :object (vals entities))) )
|
||||||
entities))
|
entities))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user