Add global asset manager
This commit is contained in:
@@ -8,10 +8,11 @@
|
||||
[com.badlogic.gdx.audio Sound]
|
||||
[com.badlogic.gdx.assets AssetManager]
|
||||
[com.badlogic.gdx.assets.loaders AsynchronousAssetLoader]
|
||||
[com.badlogic.gdx.files FileHandle]
|
||||
[com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera
|
||||
PerspectiveCamera Pixmap Pixmap$Format PixmapIO Texture
|
||||
VertexAttributes$Usage]
|
||||
[com.badlogic.gdx.graphics.g2d SpriteBatch]
|
||||
[com.badlogic.gdx.graphics.g2d ParticleEffect SpriteBatch]
|
||||
[com.badlogic.gdx.graphics.g3d ModelBatch]
|
||||
[com.badlogic.gdx.graphics.glutils ShapeRenderer]
|
||||
[com.badlogic.gdx.input GestureDetector
|
||||
@@ -165,6 +166,20 @@ handle errors and perform other custom actions each time they run.
|
||||
[wrapper-fn]
|
||||
(intern 'play-clj.core 'wrapper wrapper-fn))
|
||||
|
||||
(defn set-asset-manager!
|
||||
"Sets a global asset manager, which will keep track of objects that need to
|
||||
be manually disposed, such as `texture` entities and `pixmap` objects. The
|
||||
asset manager will then allow you to dispose them all at once.
|
||||
|
||||
; create an asset manager
|
||||
(def manager (asset-manager))
|
||||
; set it to be used by play-clj
|
||||
(set-asset-manager! manager)
|
||||
; dispose all assets at once
|
||||
(asset-manager! manager :clear)"
|
||||
[am]
|
||||
(intern 'play-clj.utils '*asset-manager* am))
|
||||
|
||||
(defn update!
|
||||
"Runs the equivalent of `(swap! screen-atom assoc ...)`, where `screen-atom`
|
||||
is the atom storing the screen map behind the scenes. Returns the updated
|
||||
|
||||
Reference in New Issue
Block a user