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