fixing android issues.

This commit is contained in:
Bryce Covert
2017-12-05 18:32:25 -08:00
parent 850a0a945d
commit a33c75e9ac
10 changed files with 66 additions and 33 deletions

View File

@@ -14,9 +14,11 @@
[advent.steam :as steam]
[clojure.core.async :refer [put! <! <!! >! chan go go-loop thread take! alts!! dropping-buffer]])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Format Pixmap$Blending Pixmap$Filter Texture Texture$TextureFilter]
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
[com.badlogic.gdx.graphics.g2d TextureRegion Animation ParticleEffect]
[play_clj.entities ParticleEffectEntity]
[com.badlogic.gdx.utils.viewport FitViewport]
[com.badlogic.gdx.utils ScreenUtils]
[com.badlogic.gdx.assets.loaders ParticleEffectLoader$ParticleEffectParameter]
[com.badlogic.gdx.graphics PixmapIO$PNG]
[com.badlogic.gdx.scenes.scene2d Actor Stage]
[com.badlogic.gdx.math CatmullRomSpline]
@@ -465,10 +467,10 @@
(defn make-music [r]
(log/info "making music from" r)
(try
(if mobile?
(doto (music (str r ".mp3")) (music! :set-looping true))
(doto (music r) (music! :set-looping true)))
(platformify (doto (music (str r ".mp3")) (music! :set-looping true))
(do (println "android")
(doto (music r) (music! :set-looping true)))
(doto (music r) (music! :set-looping true)))
(catch Exception x
(log/warn "music making error" x)
@@ -796,7 +798,10 @@
(doseq [resource (id (:resources screen))]
(println "releasing " resource)
(asset-manager! *asset-manager* :unload resource))
(try
(asset-manager! *asset-manager* :unload resource)
(catch Exception e
(println "Error releasing resource " e))))
(app! :log "info"(str "Released resources " (.getDiagnostics *asset-manager*)))
(update! screen :resources (assoc (:resources screen {}) id []))))
@@ -806,3 +811,16 @@
(animation speed (map #(get-texture (str file "-" (inc %) ".png")) frames)))
([atlas file [w h] speed frames]
(animation speed (map #(atlas->texture atlas file %) frames))))
(defn load-particle-effect [path]
(let [p (ParticleEffectLoader$ParticleEffectParameter. )
am @(resolve 'advent.core/am)]
(set! (.atlasFile p) "packed/particles/pack.atlas")
(set! (.atlasPrefix p) "")
(.load am path ParticleEffect p)
(.finishLoading am)
(let [x (ParticleEffectEntity. (.get am path ParticleEffect))]
(println (.get am "packed/particles/pack.png" Texture))
(println (.getTexture (.getSprite (.get (.getEmitters (.get am path ParticleEffect)) 0))))
x)
))