Add particle-effect

This commit is contained in:
oakes
2014-01-25 00:25:46 -05:00
parent 384fb39a37
commit 43b706dccc
4 changed files with 48 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
(:require [play-clj.utils :as u])
(:import [com.badlogic.gdx.graphics Texture]
[com.badlogic.gdx.graphics.g2d Animation BitmapFont NinePatch
TextureRegion]))
ParticleEffect TextureRegion]))
(defmacro bitmap-font
"Returns a [BitmapFont](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/BitmapFont.html)
@@ -12,6 +12,8 @@
[& options]
`(BitmapFont. ~@options))
; texture
(defn texture*
"The function version of `texture`"
[arg]
@@ -45,6 +47,8 @@
[entity k & options]
`(u/call! ^TextureRegion (u/get-obj ~entity :object) ~k ~@options))
; nine-patch
(defn nine-patch*
"The function version of `nine-patch`"
[arg]
@@ -80,6 +84,33 @@
[entity k & options]
`(u/call! ^NinePatch (u/get-obj ~entity :object) ~k ~@options))
; particle-effect
(defn particle-effect*
"The function version of `particle-effect`"
[]
(u/create-entity (ParticleEffect.)))
(defmacro particle-effect
"Returns an entity based on [ParticleEffect](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/ParticleEffect.html)
(particle-effect :load
(files! :internal \"fire.p\")
(files! :internal \"fire-images\"))"
[& options]
`(let [entity# (texture*)]
(u/calls! ^ParticleEffect (u/get-obj entity# :object) ~@options)
entity#))
(defmacro particle-effect!
"Calls a single method on a `particle-effect`
(particle-effect! entity :set-position 10 10)"
[entity k & options]
`(u/call! ^ParticleEffect (u/get-obj ~entity :object) ~k ~@options))
; animation
(defmacro play-mode
"Returns a static field from [Animation](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/Animation.html)