summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-12-03 10:41:02 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-12-03 10:41:02 +0100
commite0089b95523fb2e5131e030ee697cde092ad4103 (patch)
tree9c9a93dfa3d1b95ca128ffd25a54062db83fde84 /core/src/ch/asynk
parent3659c278215bde44762d3b4fbc5a175519c641b0 (diff)
downloadRustAndDust-e0089b95523fb2e5131e030ee697cde092ad4103.zip
RustAndDust-e0089b95523fb2e5131e030ee697cde092ad4103.tar.gz
Hud,hud... implement interface Animation
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java7
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Engagement.java9
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Msg.java10
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java7
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/UnitDock.java11
5 files changed, 30 insertions, 14 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index fd63d03..10af85b 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -9,6 +9,7 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
+import ch.asynk.tankontank.engine.gfx.Animation;
import ch.asynk.tankontank.game.State.StateType;
import ch.asynk.tankontank.game.hud.Position;
import ch.asynk.tankontank.game.hud.Msg;
@@ -21,7 +22,7 @@ import ch.asynk.tankontank.game.hud.Widget;
import ch.asynk.tankontank.TankOnTank;
-public class Hud implements Disposable
+public class Hud implements Disposable, Animation
{
public static final float OFFSET = 10f;
public static final float NOTIFY_DURATION = 2f;
@@ -77,11 +78,13 @@ public class Hud implements Disposable
actionButtons.setPosition(position.horizontalMirror());
}
- public void animate(float delta)
+ @Override
+ public boolean animate(float delta)
{
msg.animate(delta);
playerInfo.animate(delta);
engagement.animate(delta);
+ return false;
}
public void draw(Batch batch)
diff --git a/core/src/ch/asynk/tankontank/game/hud/Engagement.java b/core/src/ch/asynk/tankontank/game/hud/Engagement.java
index b21011e..a5d10cf 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Engagement.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Engagement.java
@@ -9,9 +9,10 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import ch.asynk.tankontank.game.Map;
import ch.asynk.tankontank.game.Army;
+import ch.asynk.tankontank.engine.gfx.Animation;
import ch.asynk.tankontank.engine.gfx.animations.DiceAnimation;
-public class Engagement extends Bg
+public class Engagement extends Bg implements Animation
{
public static int FLAG_HEIGHT = 24;
public float padding;
@@ -106,11 +107,13 @@ public class Engagement extends Bg
return false;
}
- public void animate(float delta)
+ @Override
+ public boolean animate(float delta)
{
- if (!visible) return;
+ if (!visible) return true;
d1Animation.animate(delta);
d2Animation.animate(delta);
+ return false;
}
@Override
diff --git a/core/src/ch/asynk/tankontank/game/hud/Msg.java b/core/src/ch/asynk/tankontank/game/hud/Msg.java
index 5675016..cc701fb 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Msg.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Msg.java
@@ -7,7 +7,9 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
-public class Msg extends Label
+import ch.asynk.tankontank.engine.gfx.Animation;
+
+public class Msg extends Label implements Animation
{
class MsgInfo
{
@@ -69,9 +71,10 @@ public class Msg extends Label
bg.set(rect);
}
- public void animate(float delta)
+ @Override
+ public boolean animate(float delta)
{
- if (!visible) return;
+ if (!visible) return true;
elapsed += delta;
if (elapsed >= duration) {
visible = false;
@@ -80,6 +83,7 @@ public class Msg extends Label
write(info.text, info.duration, info.position);
}
}
+ return false;
}
@Override
diff --git a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
index 3c25b2c..0cde301 100644
--- a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
+++ b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java
@@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
+import ch.asynk.tankontank.engine.gfx.Animation;
import ch.asynk.tankontank.engine.gfx.Drawable;
import ch.asynk.tankontank.game.State.StateType;
@@ -17,7 +18,7 @@ import ch.asynk.tankontank.game.Army;
import ch.asynk.tankontank.game.Unit;
import ch.asynk.tankontank.game.Player;
-public class PlayerInfo implements Disposable, Drawable
+public class PlayerInfo implements Disposable, Drawable, Animation
{
private final Ctrl ctrl;
@@ -150,9 +151,11 @@ public class PlayerInfo implements Disposable, Drawable
return true;
}
- public void animate(float delta)
+ @Override
+ public boolean animate(float delta)
{
unitDock.animate(delta);
+ return false;
}
@Override
diff --git a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
index ad9df87..de69004 100644
--- a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
+++ b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java
@@ -8,12 +8,13 @@ import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Rectangle;
+import ch.asynk.tankontank.engine.gfx.Animation;
import ch.asynk.tankontank.engine.Orientation;
import ch.asynk.tankontank.game.Ctrl;
import ch.asynk.tankontank.game.Unit;
import ch.asynk.tankontank.game.UnitList;
-public class UnitDock extends Bg
+public class UnitDock extends Bg implements Animation
{
private static final float SCALE = 0.4f;
private static final float STEP = 5f;
@@ -128,10 +129,11 @@ public class UnitDock extends Bg
dx = 0f;
}
- public void animate(float delta)
+ @Override
+ public boolean animate(float delta)
{
- if (!visible) return;
- if (mvtDone) return;
+ if (!visible) return true;
+ if (mvtDone) return true;
float x = (rect.x + dx);
if (show) {
@@ -159,6 +161,7 @@ public class UnitDock extends Bg
point.set((rect.x + rect.width), (rect.y + rect.height), 0).mul(transform);
scaledRect.width = point.x - scaledRect.x;
scaledRect.height = point.y - scaledRect.y;
+ return false;
}
@Override