Only allow string paths when loading assets
This commit is contained in:
@@ -148,11 +148,9 @@
|
|||||||
(.removeProcessor multi p)))
|
(.removeProcessor multi p)))
|
||||||
|
|
||||||
(defn sound*
|
(defn sound*
|
||||||
[path]
|
[^String path]
|
||||||
(or (u/load-asset path Sound)
|
(or (u/load-asset path Sound)
|
||||||
(audio! :new-sound (if (string? path)
|
(audio! :new-sound (files! :internal path))))
|
||||||
(files! :internal path)
|
|
||||||
path))))
|
|
||||||
|
|
||||||
(defmacro sound
|
(defmacro sound
|
||||||
"Returns a [Sound](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/audio/Sound.html).
|
"Returns a [Sound](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/audio/Sound.html).
|
||||||
|
|||||||
@@ -2,11 +2,8 @@
|
|||||||
|
|
||||||
(defn pixmap*
|
(defn pixmap*
|
||||||
[path]
|
[path]
|
||||||
(let [^FileHandle fh (if (string? path)
|
(or (u/load-asset path Pixmap)
|
||||||
(files! :internal path)
|
(Pixmap. (files! :internal path))))
|
||||||
path)]
|
|
||||||
(or (u/load-asset (.path fh) Pixmap)
|
|
||||||
(Pixmap. fh))))
|
|
||||||
|
|
||||||
(defmacro pixmap
|
(defmacro pixmap
|
||||||
"Returns a [Pixmap](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Pixmap.html).
|
"Returns a [Pixmap](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Pixmap.html).
|
||||||
|
|||||||
@@ -10,13 +10,11 @@
|
|||||||
ParticleEffectEntity]))
|
ParticleEffectEntity]))
|
||||||
|
|
||||||
(defn bitmap-font*
|
(defn bitmap-font*
|
||||||
[path]
|
[^String path]
|
||||||
(if (nil? path)
|
(if (nil? path)
|
||||||
(BitmapFont.)
|
(BitmapFont.)
|
||||||
(or (u/load-asset path BitmapFont)
|
(or (u/load-asset path BitmapFont)
|
||||||
(BitmapFont. (if (string? path)
|
(BitmapFont. (.internal (Gdx/files) path)))))
|
||||||
(.internal (Gdx/files) path)
|
|
||||||
path)))))
|
|
||||||
|
|
||||||
(defmacro bitmap-font
|
(defmacro bitmap-font
|
||||||
"Returns a [BitmapFont](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/BitmapFont.html).
|
"Returns a [BitmapFont](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/BitmapFont.html).
|
||||||
@@ -128,17 +126,13 @@
|
|||||||
; particle-effect
|
; particle-effect
|
||||||
|
|
||||||
(defn particle-effect*
|
(defn particle-effect*
|
||||||
[path]
|
[^String path]
|
||||||
(ParticleEffectEntity.
|
(ParticleEffectEntity.
|
||||||
(if (nil? path)
|
(if (nil? path)
|
||||||
(ParticleEffect.)
|
(ParticleEffect.)
|
||||||
(let [^Files files (Gdx/files)
|
(or (u/load-asset path ParticleEffect)
|
||||||
^FileHandle fh (if (string? path)
|
(let [^FileHandle fh (.internal (Gdx/files) path)]
|
||||||
(.internal files path)
|
(doto (ParticleEffect.) (.load fh (.parent fh))))))))
|
||||||
path)]
|
|
||||||
(or (u/load-asset (.path fh) ParticleEffect)
|
|
||||||
(doto (ParticleEffect.)
|
|
||||||
(.load fh (.parent fh))))))))
|
|
||||||
|
|
||||||
(defmacro particle-effect
|
(defmacro particle-effect
|
||||||
"Returns an entity based on [ParticleEffect](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/ParticleEffect.html).
|
"Returns an entity based on [ParticleEffect](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/ParticleEffect.html).
|
||||||
|
|||||||
@@ -36,11 +36,9 @@
|
|||||||
~@options))
|
~@options))
|
||||||
|
|
||||||
(defn skin*
|
(defn skin*
|
||||||
[path]
|
[^String path]
|
||||||
(or (u/load-asset path Skin)
|
(or (u/load-asset path Skin)
|
||||||
(Skin. (if (string? path)
|
(Skin. (.internal ^Files (Gdx/files) path))))
|
||||||
(.internal ^Files (Gdx/files) path)
|
|
||||||
path))))
|
|
||||||
|
|
||||||
(defmacro skin
|
(defmacro skin
|
||||||
"Returns a [Skin](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Skin.html)
|
"Returns a [Skin](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Skin.html)
|
||||||
|
|||||||
Reference in New Issue
Block a user