small textures on the way.

This commit is contained in:
Bryce Covert
2017-05-25 22:22:28 -07:00
parent 16819c1d36
commit 807ee8564c
222 changed files with 110 additions and 85 deletions

View File

@@ -1847,6 +1847,7 @@
(defscreen hud
:on-show
(fn [screen entities options]
(let [screen (assoc screen :total-time 0)
screen (utils/setup-viewport screen 320 240)]

View File

@@ -32,17 +32,12 @@
(defn fade-out [screen e thing then]
(assoc-in e [:tweens :fade-out]
(tween/tween :fade-out screen [thing :opacity] 1.0 0.0 0.5
:finish then
(tween/tween :fade-out screen [thing :opacity] 1.0 0.0 0.5
:finish then
:ease tween/ease-out-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 make-anim-seq [atlas file [w h] speed frames]
(animation speed (map #(utils/atlas->texture atlas file %) frames)))
(defn animate [entity screen]
(if (:anim entity)
@@ -88,9 +83,7 @@
:do (fn [screen entities]
(utils/stop-music (:pop-music entities))
(log/info "clearing assets" (into [] (.getAssetNames *asset-manager*)) (.getDiagnostics *asset-manager*))
(.clear *asset-manager* )
(log/info "cleared assets" (into [] (.getAssetNames *asset-manager*)) (.getDiagnostics *asset-manager*))
(set-screen! @(resolve 'advent.core/advent) title/title-screen)
entities)
:duration 0.0}])
@@ -99,33 +92,38 @@
(defscreen splash-screen
:on-show
(fn [screen entities options]
(println screen)
(utils/setup-viewport screen 1280 960)
(log/info "Starting splash screen.")
(graphics! :set-cursor (utils/cursor "cursor.png" :hourglass))
(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-y 80
:opacity 1.0
:origin-x 0
:origin-y 0
:z 0)
:pop-logo (assoc (utils/get-texture "black.png")
: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)
:steps steps
:pop-music (utils/make-music "music/POPPixelLogo2Audiomix_mixdown.ogg")
:current-step nil}]
(music! (:pop-music entities) :set-volume (utils/current-music-volume 1.0))
entities))
(let [splash-atlas (texture-atlas "packed/splash.atlas")
global-atlas (texture-atlas "packed/global.atlas")
screen (update! screen :resources ["packed/splash.atlas" "packed/global.atlas"])]
(utils/setup-viewport screen 1280 960)
(log/info "Starting splash screen.")
(graphics! :set-cursor (utils/cursor "cursor.png" :hourglass))
(let [screen (assoc screen :total-time 0)
pop-anim (make-anim-seq splash-atlas "POPPixelLogo_02" [320 240] 0.05 (repeat 200 0))
entities {:background (assoc (utils/atlas->texture global-atlas "black.png")
:scale-x 80
:scale-y 80
:opacity 1.0
:origin-x 0
:origin-y 0
:z 0)
:pop-logo (assoc (animation->texture screen pop-anim)
:anim pop-anim
:x 0 :y 0
:origin-x 0 :origin-y 0
:scale-x 4 :scale-y 4
:z 1)
:dbhlogo (assoc (utils/atlas->texture splash-atlas "dbh.png") :x 0 :y 0 :origin-x 0 :origin-y 0 :scale-x 4 :scale-y 4 :z 1 :opacity 0.0)
:steps steps
:pop-music (utils/make-music "music/POPPixelLogo2Audiomix_mixdown.ogg")
:current-step nil}]
(music! (:pop-music entities) :set-volume (utils/current-music-volume 1.0))
entities)))
:on-hide (fn [screen entities options]
(doseq [atlas (:resources screen)]
(asset-manager! *asset-manager* :unload atlas)
(log/info "cleared assets" (into [] (.getAssetNames *asset-manager*)) (.getDiagnostics *asset-manager*))))
:on-render
(fn [{:keys [^FitViewport viewport] :as screen} entities options]
@@ -133,7 +131,7 @@
(.apply viewport)
(clear!)
(let [entities (utils/apply-tweens screen entities (:tweens entities))
#_#_entities (update-in entities [:pop-logo] animate screen)
entities (update-in entities [:pop-logo] animate screen)
entities (if (and (:queued-skip? entities) (get-in entities [:current-step :can-skip]))
(assoc entities :queued-skip? false :current-step nil)
entities)

View File

@@ -157,11 +157,22 @@
0 0 target-width target-height)
(graphics! :new-cursor resized (* hot-x scale) (* hot-y scale) )))
(defn atlas->texture
([atlas path]
(let [region-name (str/replace path #".png" "")]
(texture (texture-atlas! atlas :find-region region-name))))
([atlas path index]
(let [region-name (str/replace path #".png" "")]
(texture (texture-atlas! atlas :find-region region-name index)))))
(defn get-texture [path]
(let [atlas-name (str/replace path #".png" "")
atlas (texture-atlas "packed/pack.atlas")]
(texture (texture-atlas! atlas :find-region atlas-name))))
(defn get-texture
([path]
(get-texture "packed/pack.atlas" path))
([atlas path]
(atlas->texture (texture-atlas atlas) path))
([atlas path index]
(atlas->texture (texture-atlas atlas) path index)))
(defn snapshot-list []