summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-10-09 11:48:52 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2018-10-09 11:48:52 +0200
commit909d7771fa7a5e65bc7b11b8674a147620f3350d (patch)
tree16e33f8753460544501e6ff3cd48b1db188426f1
parenta07149c93c1c1b5037c49cf6a6b6ec7c3aa02252 (diff)
downloadgdx-boardgame-909d7771fa7a5e65bc7b11b8674a147620f3350d.zip
gdx-boardgame-909d7771fa7a5e65bc7b11b8674a147620f3350d.tar.gz
use pieces/Piece
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java18
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java5
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/Panzer.java13
3 files changed, 12 insertions, 24 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java
index 3149e8d..cd99fb0 100644
--- a/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java
+++ b/core/src/ch/asynk/gdx/boardgame/animations/BounceAnimation.java
@@ -6,7 +6,7 @@ import com.badlogic.gdx.utils.Pool;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
-import ch.asynk.gdx.boardgame.Scalable;
+import ch.asynk.gdx.boardgame.pieces.Piece;
public class BounceAnimation extends TimedAnimation
{
@@ -18,27 +18,27 @@ public class BounceAnimation extends TimedAnimation
}
};
- public static BounceAnimation get(Scalable scalable, float duration, float bounceFactor)
+ public static BounceAnimation get(Piece piece, float duration, float bounceFactor)
{
BounceAnimation a = bounceAnimationPool.obtain();
- a.scalable = scalable;
+ a.piece = piece;
a.duration = duration;
a.bounceFactor = bounceFactor;
return a;
}
- private Scalable scalable;
+ private Piece piece;
private float bounceFactor;
private BounceAnimation()
{
}
- public BounceAnimation(Scalable scalable, float duration, float bounceFactor)
+ public BounceAnimation(Piece piece, float duration, float bounceFactor)
{
- this.scalable = scalable;
+ this.piece = piece;
this.duration = duration;
this.bounceFactor = bounceFactor;
}
@@ -54,17 +54,17 @@ public class BounceAnimation extends TimedAnimation
@Override protected void end()
{
- scalable.setScale(1f);
+ piece.setScale(1f);
}
@Override protected void update(float percent)
{
- scalable.setScale(1 + bounceFactor * (float) Math.sin(percent * Math.PI));
+ piece.setScale(1 + bounceFactor * (float) Math.sin(percent * Math.PI));
}
@Override public void draw(Batch batch)
{
- scalable.draw(batch);
+ piece.draw(batch);
}
@Override public void drawDebug(ShapeRenderer debugShapes)
diff --git a/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java b/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java
index 9871b35..5bf55c3 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Vector2;
import ch.asynk.gdx.boardgame.Camera;
+import ch.asynk.gdx.boardgame.pieces.Piece;
import ch.asynk.gdx.boardgame.boards.Board;
import ch.asynk.gdx.boardgame.boards.BoardFactory;
import ch.asynk.gdx.boardgame.ui.Alignment;
@@ -31,7 +32,7 @@ public class AnimationsScreen extends AbstractScreen
private State state;
private final Texture map;
- private final Panzer panzer;
+ private final Piece panzer;
private final Camera cam;
private final Board board;
private Animation animation;
@@ -44,7 +45,7 @@ public class AnimationsScreen extends AbstractScreen
this.board = BoardFactory.getBoard(BoardFactory.BoardType.HEX, 110, 50, 103, BoardFactory.BoardOrientation.VERTICAL);
this.camera = this.cam = new Camera(10, map.getWidth(), map.getHeight(), 1.0f, 0.3f, false);
- this.panzer = new Panzer(app);
+ this.panzer = new Piece(app.assets.getTexture(app.assets.PANZER));
Vector2 v = new Vector2();
this.board.centerOf(7, 4, v);
this.panzer.setPosition(v.x - (panzer.getWidth() / 2), v.y - (panzer.getHeight() / 2));
diff --git a/test/src/ch/asynk/gdx/boardgame/test/Panzer.java b/test/src/ch/asynk/gdx/boardgame/test/Panzer.java
deleted file mode 100644
index b24a942..0000000
--- a/test/src/ch/asynk/gdx/boardgame/test/Panzer.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package ch.asynk.gdx.boardgame.test;
-
-import com.badlogic.gdx.graphics.g2d.Sprite;
-
-import ch.asynk.gdx.boardgame.Scalable;
-
-public class Panzer extends Sprite implements Scalable
-{
- public Panzer(final GdxBoardTest app)
- {
- super(app.assets.getTexture(app.assets.PANZER));
- }
-}