summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/Animation.java2
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java6
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/DelayAnimation.java13
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/MoveAnimation.java6
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java5
5 files changed, 6 insertions, 26 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);
- }
}
diff --git a/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java b/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java
index 9e7da45..f32ab9b 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java
@@ -49,7 +49,7 @@ public class AnimationsScreen extends AbstractScreen
animations = AnimationSequence.obtain(10);
animations.add(BounceAnimation.obtain(panzer, 2f, 3f, -1));
- animations.add(DelayAnimation.obtain(panzer, 1f));
+ animations.add(DelayAnimation.obtain(1f));
animations.add(MoveAnimation.obtain(panzer, path, 2f, (p,path) -> {
Tile from = path.from();
Tile to = path.to();
@@ -57,7 +57,7 @@ public class AnimationsScreen extends AbstractScreen
from.enableOverlay(2, false);
if (to != null) to.enableOverlay(2, true);
}));
- animations.add(DelayAnimation.obtain(panzer, 1f));
+ animations.add(DelayAnimation.obtain(1f));
}
private Path buildPath(final GdxBoardTest app)
@@ -122,6 +122,7 @@ public class AnimationsScreen extends AbstractScreen
for (int i = 0; i < path.size(); i++) {
path.get(i).draw(batch);
}
+ panzer.draw(batch);
animations.draw(batch);
batch.end();
}