summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/gdx/boardgame/animations
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2019-12-17 16:22:28 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2019-12-17 16:22:28 +0100
commitbc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe (patch)
tree829e1f7b008c5262e4dd777015732582e26009c4 /core/src/ch/asynk/gdx/boardgame/animations
parent36d827659b54b04c90722eb2e431f622b33c047c (diff)
downloadgdx-boardgame-bc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe.zip
gdx-boardgame-bc6b9374d9eb228bbc3d66ed6f77ea4e6ff084fe.tar.gz
core : implement drawDebug(ShapeRenderer)
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame/animations')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/AnimationBatch.java10
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java8
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/FireAnimation.java12
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/ShotAnimation.java12
4 files changed, 42 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/AnimationBatch.java b/core/src/ch/asynk/gdx/boardgame/animations/AnimationBatch.java
index 9fdcfb9..1bc047f 100644
--- a/core/src/ch/asynk/gdx/boardgame/animations/AnimationBatch.java
+++ b/core/src/ch/asynk/gdx/boardgame/animations/AnimationBatch.java
@@ -2,6 +2,7 @@ package ch.asynk.gdx.boardgame.animations;
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.utils.IterableArray;
@@ -78,4 +79,13 @@ public class AnimationBatch implements Animation, Pool.Poolable
}
}
}
+
+ @Override public void drawDebug(ShapeRenderer shapeRenderer)
+ {
+ if (!completed()) {
+ for (Animation animation : animations) {
+ animation.drawDebug(shapeRenderer);
+ }
+ }
+ }
}
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java b/core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java
index 0569a40..08091d2 100644
--- a/core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java
+++ b/core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java
@@ -2,6 +2,7 @@ package ch.asynk.gdx.boardgame.animations;
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.utils.IterableArray;
@@ -75,4 +76,11 @@ public class AnimationSequence implements Animation, Pool.Poolable
animations.get(0).draw(batch);
}
}
+
+ @Override public void drawDebug(ShapeRenderer shapeRenderer)
+ {
+ if (!completed()) {
+ animations.get(0).drawDebug(shapeRenderer);
+ }
+ }
}
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/FireAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/FireAnimation.java
index a8b4546..6e44d40 100644
--- a/core/src/ch/asynk/gdx/boardgame/animations/FireAnimation.java
+++ b/core/src/ch/asynk/gdx/boardgame/animations/FireAnimation.java
@@ -3,6 +3,7 @@ package ch.asynk.gdx.boardgame.animations;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
+import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.Pool;
@@ -187,4 +188,15 @@ public class FireAnimation implements Animation, Pool.Poolable
}
}
}
+
+ @Override public void drawDebug(ShapeRenderer shapeRenderer)
+ {
+ if (single) {
+ this.shot.drawDebug(shapeRenderer);
+ } else {
+ for (ShotAnimation shot : this.shots) {
+ shot.drawDebug(shapeRenderer);
+ }
+ }
+ }
}
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/ShotAnimation.java b/core/src/ch/asynk/gdx/boardgame/animations/ShotAnimation.java
index 890b6a4..ad2d198 100644
--- a/core/src/ch/asynk/gdx/boardgame/animations/ShotAnimation.java
+++ b/core/src/ch/asynk/gdx/boardgame/animations/ShotAnimation.java
@@ -4,6 +4,7 @@ import java.util.Random;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.g2d.Batch;
+import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.Pool;
@@ -183,4 +184,15 @@ public class ShotAnimation extends TimedAnimation implements Drawable, Pool.Pool
this.explosionSprites.draw(batch);
}
}
+
+ @Override public void drawDebug(ShapeRenderer shapeRenderer)
+ {
+ if (drawFire) {
+ this.shellSprites.drawDebug(shapeRenderer);
+ }
+
+ if (drawExplosion) {
+ this.explosionSprites.drawDebug(shapeRenderer);
+ }
+ }
}