fixing android issues.
This commit is contained in:
@@ -100,10 +100,15 @@
|
||||
(put! (get-in starting-entities# [:fg-actions :script-chan])
|
||||
(fn [starting-entities#]
|
||||
(let [~entities (atom starting-entities#)]
|
||||
(thread (binding [*fg-bg-key* :fg-actions]
|
||||
~@forms
|
||||
(change-script-state ~entities false)
|
||||
(utils/save @~entities "autosave" "Autosave"))))))))
|
||||
(thread (try (binding [*fg-bg-key* :fg-actions]
|
||||
~@forms
|
||||
(change-script-state ~entities false)
|
||||
(utils/save @~entities "autosave" "Autosave"))
|
||||
(catch clojure.lang.ExceptionInfo e#
|
||||
(println "caught exception" e#))
|
||||
(catch Exception e#
|
||||
(println "Caught exception")
|
||||
(.printStackTrace e#)))))))))
|
||||
|
||||
(defn force-end [entities current-action key]
|
||||
(do (when current-action
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
[play-clj.ui :refer :all]
|
||||
[play-clj.utils :refer :all]
|
||||
[play-clj.g2d :refer :all]
|
||||
[advent.iap :as iap]
|
||||
[advent.ios :as ios])
|
||||
[advent.iap :as iap])
|
||||
(:import [com.badlogic.gdx.graphics Color]
|
||||
[com.badlogic.gdx Application Gdx]))
|
||||
|
||||
|
||||
@@ -420,8 +420,8 @@
|
||||
[860 650] [950 700] [1030 800] [1280 960] [1300 1000]
|
||||
[-50 1000] [-50 -50]]) true)
|
||||
:z 3)
|
||||
:particle-clouds (assoc (particle-effect "particles/particle-clouds" :reset :start) :x 640 :y 480 :z 1)
|
||||
:ego-jet (assoc (particle-effect "particles/jet" :reset :start) :x 450 :y 650 :z 4)
|
||||
:particle-clouds (assoc (doto (utils/load-particle-effect "particles/particle-clouds") (particle-effect! :reset) (particle-effect! :start)) :x 640 :y 480 :z 1)
|
||||
:ego-jet (assoc (doto (utils/load-particle-effect "particles/jet") (particle-effect! :reset) (particle-effect! :start)) :x 450 :y 650 :z 4)
|
||||
|
||||
:main-menu (->> (main-menu screen)
|
||||
(utils/add-actor-to-stage screen))
|
||||
@@ -439,9 +439,9 @@
|
||||
(utils/play-music (:music %)) %)
|
||||
:ease tween/ease-in-quadratic)}}
|
||||
]
|
||||
(println "after load" (.getDiagnostics @(resolve 'advent.core/am)))
|
||||
(merge entities (:main-menu entities))))))
|
||||
|
||||
|
||||
:on-render
|
||||
(fn [{:keys [^FitViewport viewport] :as screen} entities options]
|
||||
#_(steam/update)
|
||||
|
||||
@@ -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)
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user