Adjust loader macro to pass options to constructor

This commit is contained in:
oakes
2014-04-11 18:55:48 -04:00
parent 8570399128
commit 4f94b5a495
3 changed files with 17 additions and 27 deletions

View File

@@ -11,14 +11,14 @@
"gdx-array-map!" :methods}
"AssetManager" {"asset-manager" :methods
"asset-manager!" :methods}
"AtlasTmxMapLoader" {"loader :atlas-tmx-map" :methods
"AtlasTmxMapLoader" {"loader :atlas-tmx-map" :constructors
"loader! :atlas-tmx-map" :methods}
"Audio" {"audio!" :methods}
"Bezier" {"bezier" :methods
"bezier!" :methods}
"BitmapFont" {"bitmap-font" :constructors
"bitmap-font!" :methods}
"BitmapFontLoader" {"loader :bitmap-font" :methods
"BitmapFontLoader" {"loader :bitmap-font" :constructors
"loader! :bitmap-font" :methods}
"BlendingAttribute" {"attribute :blending" :constructors
"attribute-type :blending" :static-fields
@@ -82,7 +82,7 @@
"FrictionJointDef" {"joint-def :friction" :fields}
"Frustum" {"frustum" :methods
"frustum!" :methods}
"G3dModelLoader" {"loader :g3d-model" :methods
"G3dModelLoader" {"loader :g3d-model" :constructors
"loader! :g3d-model" :methods}
"GearJointDef" {"joint-def :gear" :fields}
"GeometryUtils" {"geometry!" :static-methods}
@@ -144,10 +144,10 @@
"model-builder!" :methods}
"ModelInstance" {"model" :methods
"model!" :methods}
"ModelLoader" {"loader :model" :methods
"ModelLoader" {"loader :model" :constructors
"loader! :model" :methods}
"MouseJointDef" {"joint-def :mouse" :fields}
"MusicLoader" {"loader :music" :methods
"MusicLoader" {"loader :music" :constructors
"loader! :music" :methods}
"Net" {"net!" :methods}
"NinePatch" {"nine-patch" :methods
@@ -157,7 +157,7 @@
"orthogonal-tiled-map!" :methods}
"OrthographicCamera" {"orthographic" :methods
"orthographic!" :methods}
"ObjLoader" {"loader :obj" :methods
"ObjLoader" {"loader :obj" :constructors
"loader! :obj" :methods}
"ParticleEffect" {"particle-effect" :methods
"particle-effect!" :methods}
@@ -165,7 +165,7 @@
"perspective!" :methods}
"Pixmap" {"pixmap" :constructors
"pixmap!" :methods}
"PixmapLoader" {"loader :pixmap" :methods
"PixmapLoader" {"loader :pixmap" :constructors
"loader! :pixmap" :methods}
"Plane" {"plane" :methods
"plane!" :methods}
@@ -200,13 +200,13 @@
"ShapeRenderer.ShapeType" {"shape-type" :static-fields}
"Skin" {"skin" :methods
"skin!" :methods}
"SkinLoader" {"loader :skin" :methods
"SkinLoader" {"loader :skin" :constructors
"loader! :skin" :methods}
"Slider" {"slider" :methods
"slider!" :methods}
"Sound" {"sound" :methods
"sound!" :methods}
"SoundLoader" {"loader :sound" :methods
"SoundLoader" {"loader :sound" :constructors
"loader! :sound" :methods}
"SplitPane.SplitPaneStyle" {"style :split-pane" :constructors}
"SpriteDrawable" {"drawable :sprite" :constructors}
@@ -227,7 +227,7 @@
"TextField" {"text-field" :methods
"text-field!" :methods}
"TextField.TextFieldStyle" {"style :text-field" :constructors}
"TextureLoader" {"loader :texture" :methods
"TextureLoader" {"loader :texture" :constructors
"loader! :texture" :methods}
"TextureMapObject" {"map-object :texture" :methods}
"TextureRegion" {"texture" :methods
@@ -235,7 +235,7 @@
"TextureRegionDrawable" {"drawable :texture-region" :constructors}
"Tree" {"tree" :methods
"tree!" :methods}
"TmxMapLoader" {"loader :tmx-map" :methods
"TmxMapLoader" {"loader :tmx-map" :constructors
"loader! :tmx-map" :methods}
"Touchpad.TouchpadStyle" {"style :touchpad" :constructors}
"TiledMap" {"tiled-map" :methods

View File

@@ -6,6 +6,7 @@
InputMultiplexer InputProcessor Net Screen]
[com.badlogic.gdx.audio Sound]
[com.badlogic.gdx.assets AssetManager]
[com.badlogic.gdx.assets.loaders AsynchronousAssetLoader]
[com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera
PerspectiveCamera Pixmap Pixmap$Format PixmapIO Texture VertexAttributes$Usage]
[com.badlogic.gdx.graphics.g2d SpriteBatch]

View File

@@ -125,28 +125,17 @@ found."
(u/gdx :assets :loaders (str (u/key->pascal k) "Loader."))))
(defmacro loader
"Returns a subclass of [AsynchronousAssetLoader](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/loaders/AsynchronousAssetLoader.html).
(loader :atlas-tmx-map \"map.atlas\")
(loader :tmx-map \"map.tmx\")
(loader :obj \"model.obj\")
(loader :g3d-model \"cube.g3dj\")
(loader :bitmap-font \"arial.fnt\")
(loader :music \"song.ogg\")
(loader :pixmap \"background.png\")
(loader :skin \"uiskin.json\")
(loader :sound \"hit.ogg\")
(loader :texture \"monster.png\")"
[type resolver & options]
`(let [object# (~(loader-init type) ~resolver)]
(u/calls! object# ~@options)))
"Returns a subclass of [AsynchronousAssetLoader](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/loaders/AsynchronousAssetLoader.html)."
[type & options]
`(~(loader-init type) ~@options))
(defmacro loader!
"Calls a single method in a subclass of [AsynchronousAssetLoader](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/loaders/AsynchronousAssetLoader.html).
(loader! object :load \"map.tmx\")"
[object & options]
`(u/call! ~object ~@options))
`(let [^AsynchronousAssetLoader object# ~object]
(u/call! object# ~@options)))
(defn asset-manager*
([]