smaller textures.
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>duration</key>
|
|
||||||
<real>1</real>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
</plist>
|
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,13 +1,125 @@
|
|||||||
|
|
||||||
global.png
|
global.png
|
||||||
size: 64,32
|
size: 1024,64
|
||||||
format: RGBA8888
|
format: RGBA8888
|
||||||
filter: Nearest,Nearest
|
filter: Nearest,Nearest
|
||||||
repeat: none
|
repeat: none
|
||||||
black
|
black
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 2, 2
|
xy: 530, 38
|
||||||
size: 32, 24
|
size: 32, 24
|
||||||
orig: 32, 24
|
orig: 32, 24
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
|
close
|
||||||
|
rotate: false
|
||||||
|
xy: 530, 20
|
||||||
|
size: 16, 16
|
||||||
|
orig: 16, 16
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
inventory
|
||||||
|
rotate: false
|
||||||
|
xy: 2, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-1
|
||||||
|
rotate: false
|
||||||
|
xy: 2, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-11
|
||||||
|
rotate: false
|
||||||
|
xy: 398, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-12
|
||||||
|
rotate: false
|
||||||
|
xy: 442, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-13
|
||||||
|
rotate: false
|
||||||
|
xy: 486, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-2
|
||||||
|
rotate: false
|
||||||
|
xy: 46, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-3
|
||||||
|
rotate: false
|
||||||
|
xy: 90, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-4
|
||||||
|
rotate: false
|
||||||
|
xy: 134, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-5
|
||||||
|
rotate: false
|
||||||
|
xy: 178, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-6
|
||||||
|
rotate: false
|
||||||
|
xy: 222, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-7
|
||||||
|
rotate: false
|
||||||
|
xy: 266, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-8
|
||||||
|
rotate: false
|
||||||
|
xy: 310, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-10
|
||||||
|
rotate: false
|
||||||
|
xy: 310, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
open-inventory-9
|
||||||
|
rotate: false
|
||||||
|
xy: 354, 6
|
||||||
|
size: 42, 56
|
||||||
|
orig: 42, 56
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
save
|
||||||
|
rotate: false
|
||||||
|
xy: 530, 2
|
||||||
|
size: 16, 16
|
||||||
|
orig: 16, 16
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 5.9 KiB |
@@ -1478,7 +1478,6 @@
|
|||||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||||
:finish #(do
|
:finish #(do
|
||||||
(utils/stop-all-sounds! %)
|
(utils/stop-all-sounds! %)
|
||||||
(asset-manager! @(resolve 'advent.core/am) :clear)
|
|
||||||
(set-screen! @(resolve 'advent.core/advent) @(resolve 'advent.screens.title/title-screen))
|
(set-screen! @(resolve 'advent.core/advent) @(resolve 'advent.screens.title/title-screen))
|
||||||
%))))))
|
%))))))
|
||||||
|
|
||||||
@@ -1848,7 +1847,8 @@
|
|||||||
:on-show
|
:on-show
|
||||||
(fn [screen entities options]
|
(fn [screen entities options]
|
||||||
|
|
||||||
(let [screen (assoc screen :total-time 0)
|
(let [[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||||
|
screen (assoc screen :total-time 0)
|
||||||
screen (utils/setup-viewport screen 320 240)]
|
screen (utils/setup-viewport screen 320 240)]
|
||||||
|
|
||||||
|
|
||||||
@@ -1860,29 +1860,29 @@
|
|||||||
:pending-states []}
|
:pending-states []}
|
||||||
:already-saved? false
|
:already-saved? false
|
||||||
|
|
||||||
:close (assoc (utils/get-texture "close.png")
|
:close (assoc (utils/atlas->texture global-atlas "close")
|
||||||
:x 320 :y 240
|
:x 320 :y 240
|
||||||
:origin-x 16 :origin-y 16
|
:origin-x 16 :origin-y 16
|
||||||
:width 16 :height 16
|
:width 16 :height 16
|
||||||
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
||||||
:baseline 9000
|
:baseline 9000
|
||||||
:opacity 0.8)
|
:opacity 0.8)
|
||||||
:save (assoc (utils/get-texture "save.png")
|
:save (assoc (utils/atlas->texture global-atlas "save")
|
||||||
:x (- 320 (* utils/ui-scale 16) 4) :y 240
|
:x (- 320 (* utils/ui-scale 16) 4) :y 240
|
||||||
:origin-x 16 :origin-y 16
|
:origin-x 16 :origin-y 16
|
||||||
:width 16 :height 16
|
:width 16 :height 16
|
||||||
:baseline 9000
|
:baseline 9000
|
||||||
:opacity 0.8)
|
:opacity 0.8)
|
||||||
:inventory (assoc (utils/get-texture "inventory.png") :x (* 21 utils/ui-scale ) :y (* 27 utils/ui-scale ) :baseline 9000
|
:inventory (assoc (utils/atlas->texture global-atlas "inventory") :x (* 21 utils/ui-scale ) :y (* 27 utils/ui-scale ) :baseline 9000
|
||||||
:intersect-width 42 :intersect-height 48
|
:intersect-width 42 :intersect-height 48
|
||||||
:width 42 :height 56
|
:width 42 :height 56
|
||||||
:origin-x 21 :origin-y 27
|
:origin-x 21 :origin-y 27
|
||||||
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
||||||
:open (utils/flip (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 (flatten [(range 6) 6 7 8 7 ]))
|
:open (utils/flip (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 (flatten [(range 6) 6 7 8 7 ]))
|
||||||
(animation! :set-play-mode (play-mode :normal))))
|
(animation! :set-play-mode (play-mode :normal))))
|
||||||
:anim (utils/flip (utils/make-anim "inventory.png" [42 56] 0.1 [0]))
|
:anim (utils/flip (utils/make-anim global-atlas "inventory" [42 56] 0.1 [0]))
|
||||||
:anim-loop? false
|
:anim-loop? false
|
||||||
:default (utils/flip (utils/make-anim "inventory.png" [42 56] 0.1 [0]))
|
:default (utils/flip (utils/make-anim global-atlas "inventory" [42 56] 0.1 [0]))
|
||||||
:opened (utils/flip (utils/make-anim-seq "open-inventory" [42 56] 0.1 [7]))
|
:opened (utils/flip (utils/make-anim-seq "open-inventory" [42 56] 0.1 [7]))
|
||||||
:closing (utils/flip (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 [7 7 7 7 7 7 7 9 10 11 12 0])
|
:closing (utils/flip (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 [7 7 7 7 7 7 7 9 10 11 12 0])
|
||||||
(animation! :set-play-mode (play-mode :normal))))
|
(animation! :set-play-mode (play-mode :normal))))
|
||||||
@@ -2050,4 +2050,7 @@
|
|||||||
(assoc entities :already-saved? true))
|
(assoc entities :already-saved? true))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
nil)))))
|
nil))))
|
||||||
|
:on-hide
|
||||||
|
(fn [screen entities options]
|
||||||
|
(utils/release-resources screen)))
|
||||||
|
|||||||
@@ -160,11 +160,14 @@
|
|||||||
(defn atlas->texture
|
(defn atlas->texture
|
||||||
([atlas path]
|
([atlas path]
|
||||||
(let [region-name (str/replace path #".png" "")]
|
(let [region-name (str/replace path #".png" "")]
|
||||||
|
(if-let [region (texture-atlas! atlas :find-region region-name)]
|
||||||
(texture (texture-atlas! atlas :find-region region-name))))
|
(texture region)
|
||||||
|
(log/error path "not found"))))
|
||||||
([atlas path index]
|
([atlas path index]
|
||||||
(let [region-name (str/replace path #".png" "")]
|
(let [region-name (str/replace path #".png" "")]
|
||||||
(texture (texture-atlas! atlas :find-region region-name index)))))
|
(if-let [region (texture-atlas! atlas :find-region region-name index)]
|
||||||
|
(texture region)
|
||||||
|
(log/error path index "not found")))))
|
||||||
|
|
||||||
(defn get-texture
|
(defn get-texture
|
||||||
([path]
|
([path]
|
||||||
@@ -349,28 +352,46 @@
|
|||||||
(texture! frame :flip true false)
|
(texture! frame :flip true false)
|
||||||
frame))))
|
frame))))
|
||||||
|
|
||||||
(defn split-texture [file [^int tile-width ^int tile-height] frames]
|
(defn split-texture
|
||||||
(let [sheet (get-texture file)
|
([file [^int tile-width ^int tile-height] frames]
|
||||||
sheet-obj ^TextureRegion (:object sheet)
|
(let [sheet (get-texture file)
|
||||||
width ^int (int (.getRegionWidth sheet-obj))
|
sheet-obj ^TextureRegion (:object sheet)
|
||||||
x ^int (int (.getRegionX sheet-obj))
|
width ^int (int (.getRegionWidth sheet-obj))
|
||||||
y ^int (int (.getRegionY sheet-obj))]
|
x ^int (int (.getRegionX sheet-obj))
|
||||||
(for [frame frames
|
y ^int (int (.getRegionY sheet-obj))]
|
||||||
:let [new-tex ^TextureRegion (TextureRegion. sheet-obj)]]
|
(for [frame frames
|
||||||
(do
|
:let [new-tex ^TextureRegion (TextureRegion. sheet-obj)]]
|
||||||
(.setRegion new-tex
|
(do
|
||||||
^int (unchecked-add x (unchecked-multiply tile-width frame))
|
(.setRegion new-tex
|
||||||
y
|
^int (unchecked-add x (unchecked-multiply tile-width frame))
|
||||||
tile-width
|
y
|
||||||
tile-height)
|
tile-width
|
||||||
(->TextureEntity new-tex)))))
|
tile-height)
|
||||||
|
(->TextureEntity new-tex)))))
|
||||||
|
|
||||||
(defn make-anim [file [w h] speed frames]
|
([atlas file [^int tile-width ^int tile-height] frames]
|
||||||
(animation speed (split-texture file [w h] frames)))
|
(let [sheet (atlas->texture atlas file)
|
||||||
|
sheet-obj ^TextureRegion (:object sheet)
|
||||||
|
width ^int (int (.getRegionWidth sheet-obj))
|
||||||
|
x ^int (int (.getRegionX sheet-obj))
|
||||||
|
y ^int (int (.getRegionY sheet-obj))]
|
||||||
|
(for [frame frames
|
||||||
|
:let [new-tex ^TextureRegion (TextureRegion. sheet-obj)]]
|
||||||
|
(do
|
||||||
|
(.setRegion new-tex
|
||||||
|
^int (unchecked-add x (unchecked-multiply tile-width frame))
|
||||||
|
y
|
||||||
|
tile-width
|
||||||
|
tile-height)
|
||||||
|
(->TextureEntity new-tex))))))
|
||||||
|
|
||||||
(defn make-anim-seq [file [w h] speed frames]
|
(defn make-anim
|
||||||
(animation speed (map #(get-texture (str file "-" (inc %) ".png")) frames)))
|
([file [w h] speed frames]
|
||||||
|
(animation speed (split-texture file [w h] frames)))
|
||||||
|
([atlas file [w h] speed frames]
|
||||||
|
(animation speed (split-texture atlas file [w h] frames))))
|
||||||
|
|
||||||
|
=
|
||||||
(defn make-bird [screen p]
|
(defn make-bird [screen p]
|
||||||
(let [bird-sheet (texture! (get-texture "outside-castle/bird.png") :split 1 2)
|
(let [bird-sheet (texture! (get-texture "outside-castle/bird.png") :split 1 2)
|
||||||
bird-stand (animation 0.15 (for [i [0 1]]
|
bird-stand (animation 0.15 (for [i [0 1]]
|
||||||
@@ -755,3 +776,9 @@
|
|||||||
(doseq [resource (:resources screen)]
|
(doseq [resource (:resources screen)]
|
||||||
(asset-manager! *asset-manager* :unload resource))
|
(asset-manager! *asset-manager* :unload resource))
|
||||||
(app! :log "info"(str "Released resources " (.getDiagnostics *asset-manager*))))
|
(app! :log "info"(str "Released resources " (.getDiagnostics *asset-manager*))))
|
||||||
|
|
||||||
|
(defn make-anim-seq
|
||||||
|
([file [w h] speed frames]
|
||||||
|
(animation speed (map #(get-texture (str file "-" (inc %) ".png")) frames)))
|
||||||
|
([atlas file [w h] speed frames]
|
||||||
|
(animation speed (map #(atlas->texture atlas file %) frames))))
|
||||||
|
|||||||