other various changes
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
:url "https://github.com/oakes/play-clj"
|
||||
:license {:name "Public Domain"
|
||||
:url "http://unlicense.org/UNLICENSE"}
|
||||
:dependencies [[com.badlogicgames.gdx/gdx "1.5.3"]
|
||||
[com.badlogicgames.gdx/gdx-box2d "1.5.3"]
|
||||
[com.badlogicgames.gdx/gdx-bullet "1.5.3"]
|
||||
:dependencies [[com.badlogicgames.gdx/gdx "1.9.5"]
|
||||
[com.badlogicgames.gdx/gdx-box2d "1.9.5"]
|
||||
[com.badlogicgames.gdx/gdx-bullet "1.9.5"]
|
||||
[org.clojure/clojure "1.6.0"]]
|
||||
:repositories [["sonatype"
|
||||
"https://oss.sonatype.org/content/repositories/releases/"]]
|
||||
|
||||
45
src-java/play_clj/Animation2.java
Normal file
45
src-java/play_clj/Animation2.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package play_clj;
|
||||
import com.badlogic.gdx.graphics.g2d.Animation;
|
||||
import java.util.Arrays;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
public class Animation2 extends Animation<TextureRegion> {
|
||||
public Animation2(float x ,TextureRegion[] y) {
|
||||
super(x, y);
|
||||
}
|
||||
|
||||
|
||||
public Animation2(float x , Array<? extends TextureRegion> y, Animation.PlayMode z) {
|
||||
super(x, y, z);
|
||||
}
|
||||
|
||||
public TextureRegion getKeyFrame(float stateTime) {
|
||||
return super.getKeyFrame(stateTime);
|
||||
}
|
||||
|
||||
public TextureRegion getKeyFrame(float stateTime, boolean looping) {
|
||||
return super.getKeyFrame(stateTime, looping);
|
||||
}
|
||||
|
||||
|
||||
public TextureRegion getKeyFrame(double stateTime) {
|
||||
return super.getKeyFrame((float) stateTime);
|
||||
}
|
||||
|
||||
public TextureRegion getKeyFrame(double stateTime, boolean looping) {
|
||||
return super.getKeyFrame((float)stateTime, looping);
|
||||
}
|
||||
|
||||
public TextureRegion getKeyFrame(int stateTime) {
|
||||
return super.getKeyFrame((float)stateTime);
|
||||
}
|
||||
|
||||
public TextureRegion getKeyFrame(int stateTime, boolean looping) {
|
||||
return super.getKeyFrame((float)stateTime, looping);
|
||||
}
|
||||
|
||||
public Object[] getRawKeyFrames() {
|
||||
return super.getKeyFrames();
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,9 @@
|
||||
(:import [com.badlogic.gdx Files Gdx]
|
||||
[com.badlogic.gdx.files FileHandle]
|
||||
[com.badlogic.gdx.graphics Pixmap Texture]
|
||||
[play_clj Animation2]
|
||||
[com.badlogic.gdx.graphics.g2d Animation BitmapFont NinePatch
|
||||
|
||||
ParticleEffect TextureAtlas TextureRegion]
|
||||
[play_clj.entities TextureEntity NinePatchEntity
|
||||
ParticleEffectEntity]))
|
||||
@@ -190,7 +192,7 @@
|
||||
|
||||
(defn animation*
|
||||
[duration textures]
|
||||
(Animation. duration
|
||||
(Animation2. duration
|
||||
(u/gdx-array (map #(u/get-obj % :object) textures))
|
||||
(play-mode :normal)))
|
||||
|
||||
@@ -201,14 +203,14 @@
|
||||
[walk-1 walk-2 walk-3]
|
||||
:set-play-mode (play-mode :loop-pingpong))"
|
||||
[duration textures & options]
|
||||
`(u/calls! ^Animation (animation* ~duration ~textures) ~@options))
|
||||
`(u/calls! ^Animation2 (animation* ~duration ~textures) ~@options))
|
||||
|
||||
(defmacro animation!
|
||||
"Calls a single method on an `animation`.
|
||||
|
||||
(animation! object :set-play-mode (play-mode :loop))"
|
||||
[object k & options]
|
||||
(let [object (vary-meta object assoc :tag `Animation)]
|
||||
(let [object (vary-meta object assoc :tag `Animation2)]
|
||||
`(u/call! ~object ~k ~@options)))
|
||||
|
||||
(defn animation->texture
|
||||
@@ -216,7 +218,7 @@
|
||||
time the `screen` has been showing.
|
||||
|
||||
(animation->texture screen anim)"
|
||||
([{:keys [total-time] :as screen} ^Animation animation]
|
||||
(texture* (.getKeyFrame animation total-time true)))
|
||||
([{:keys [total-time] :as screen} ^Animation animation is-looping?]
|
||||
(texture* (.getKeyFrame animation total-time is-looping?))))
|
||||
([{:keys [total-time] :as screen} ^Animation2 animation]
|
||||
(texture* (.getKeyFrame ^Animation2 animation total-time true)))
|
||||
([{:keys [total-time] :as screen} ^Animation2 animation is-looping?]
|
||||
(texture* (.getKeyFrame ^Animation2 animation total-time is-looping?))))
|
||||
|
||||
11
texture
Normal file
11
texture
Normal file
@@ -0,0 +1,11 @@
|
||||
src/play_clj/g2d.clj:(defn animation->texture
|
||||
src/play_clj/g2d.clj: (animation->texture screen anim)"
|
||||
doclet/resources/classes.edn: "AnimationController" {"animation-controller" :methods
|
||||
doclet/resources/classes.edn: "animation-controller!" :methods}
|
||||
src/play_clj/g3d.clj:; animation-controller
|
||||
src/play_clj/g3d.clj:(defn animation-controller*
|
||||
src/play_clj/g3d.clj:(defmacro animation-controller
|
||||
src/play_clj/g3d.clj: (animation-controller model-entity)"
|
||||
src/play_clj/g3d.clj: `(let [^AnimationController object# (animation-controller* ~entity)]
|
||||
src/play_clj/g3d.clj:(defmacro animation-controller!
|
||||
src/play_clj/g3d.clj: "Calls a single method on an `animation-controller`."
|
||||
Reference in New Issue
Block a user