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

View File

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

View File

@@ -125,28 +125,17 @@ found."
(u/gdx :assets :loaders (str (u/key->pascal k) "Loader.")))) (u/gdx :assets :loaders (str (u/key->pascal k) "Loader."))))
(defmacro loader (defmacro loader
"Returns a subclass of [AsynchronousAssetLoader](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/loaders/AsynchronousAssetLoader.html). "Returns a subclass of [AsynchronousAssetLoader](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/loaders/AsynchronousAssetLoader.html)."
[type & options]
(loader :atlas-tmx-map \"map.atlas\") `(~(loader-init type) ~@options))
(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)))
(defmacro loader! (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). "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\")" (loader! object :load \"map.tmx\")"
[object & options] [object & options]
`(u/call! ~object ~@options)) `(let [^AsynchronousAssetLoader object# ~object]
(u/call! object# ~@options)))
(defn asset-manager* (defn asset-manager*
([] ([]