diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-11-15 14:48:59 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-11-15 14:48:59 +0100 |
commit | a490b726204a1ce6a27e24f331f12ea563342cb0 (patch) | |
tree | 10cf1e3dffa15519a9d53a290b7beb4706c8d053 /core/src/ch/asynk/gdx/boardgame | |
parent | 4a8646dbe1e429e1abd5c5e11cf14522a4561a7a (diff) | |
download | gdx-boardgame-a490b726204a1ce6a27e24f331f12ea563342cb0.zip gdx-boardgame-a490b726204a1ce6a27e24f331f12ea563342cb0.tar.gz |
Animation : add public default void draw(Batch) { }
animations draw there internal textures,
apply modifications on pieces,
but do not draw them themselves.
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame')
4 files changed, 3 insertions, 24 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/Animation.java b/core/src/ch/asynk/gdx/boardgame/animations/Animation.java index 52c0889..de174c3 100644 --- a/core/src/ch/asynk/gdx/boardgame/animations/Animation.java +++ b/core/src/ch/asynk/gdx/boardgame/animations/Animation.java @@ -1,5 +1,6 @@ package ch.asynk.gdx.boardgame.animations; +import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.utils.Disposable; import ch.asynk.gdx.boardgame.Drawable; @@ -8,4 +9,5 @@ public interface Animation extends Drawable, Disposable { public boolean completed(); public boolean animate(float delta); + public default void draw(Batch batch) { }; } diff --git a/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java index 285447a..d67457a 100644 --- a/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java +++ b/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java @@ -3,7 +3,6 @@ package ch.asynk.gdx.boardgame.animations; import java.lang.Math; import com.badlogic.gdx.utils.Pool; -import com.badlogic.gdx.graphics.g2d.Batch; import ch.asynk.gdx.boardgame.Piece; @@ -79,9 +78,4 @@ public class BounceAnimation extends TimedAnimation implements Pool.Poolable piece.setRotation(this.startRotation + (percent * this.rotationDegrees)); } } - - @Override public void draw(Batch batch) - { - piece.draw(batch); - } } diff --git a/core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java index 9b0b6d9..13621bc 100644 --- a/core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java +++ b/core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java @@ -1,9 +1,6 @@ package ch.asynk.gdx.boardgame.animations; import com.badlogic.gdx.utils.Pool; -import com.badlogic.gdx.graphics.g2d.Batch; - -import ch.asynk.gdx.boardgame.Drawable; public class DelayAnimation extends TimedAnimation implements Pool.Poolable { @@ -15,18 +12,15 @@ public class DelayAnimation extends TimedAnimation implements Pool.Poolable } }; - public static DelayAnimation obtain(Drawable drawable, float duration) + public static DelayAnimation obtain(float duration) { DelayAnimation a = delayAnimationPool.obtain(); - a.drawable = drawable; a.setDuration(duration); return a; } - private Drawable drawable; - private DelayAnimation() { } @@ -44,9 +38,4 @@ public class DelayAnimation extends TimedAnimation implements Pool.Poolable @Override protected void begin() { } @Override protected void end() { } @Override protected void update(float delta) { } - - @Override public void draw(Batch batch) - { - drawable.draw(batch); - } } diff --git a/core/src/ch/asynk/gdx/boardgame/animations/MoveAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/MoveAnimation.java index 0da5a0d..3cb9750 100644 --- a/core/src/ch/asynk/gdx/boardgame/animations/MoveAnimation.java +++ b/core/src/ch/asynk/gdx/boardgame/animations/MoveAnimation.java @@ -1,7 +1,6 @@ package ch.asynk.gdx.boardgame.animations; import com.badlogic.gdx.utils.Pool; -import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.math.Vector3; import ch.asynk.gdx.boardgame.Piece; @@ -123,9 +122,4 @@ public class MoveAnimation implements Animation, Pool.Poolable return (percent >= 1f); } - - @Override public void draw(Batch batch) - { - piece.draw(batch); - } } |