summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/engine
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-21 16:33:03 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-21 16:33:03 +0200
commit6bd0aacc67c386b8c2baa31e120b6ae178b9861d (patch)
treee455b24a859344800da8530e08c6360b74712175 /core/src/ch/asynk/tankontank/engine
parent937da67d9a9ce48f8e024f816485d83ea8fc5675 (diff)
downloadRustAndDust-6bd0aacc67c386b8c2baa31e120b6ae178b9861d.zip
RustAndDust-6bd0aacc67c386b8c2baa31e120b6ae178b9861d.tar.gz
Board: add drawing stats to drawDebug(...)
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 05f90f2..a3eeaa0 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -4,6 +4,8 @@ import java.util.Vector;
import java.util.Iterator;
import java.util.LinkedHashSet;
+import com.badlogic.gdx.Gdx;
+
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.graphics.Texture;
@@ -45,6 +47,9 @@ public abstract class Board extends Image implements Disposable
private Matrix4 prevTransform;
private Matrix4 nextTransform;
+ private int tileCount = 0;
+ private int pawnCount = 0;
+ private int animationCount = 0;
private final Vector<Animation> animations = new Vector<Animation>(2);
private final Vector<Animation> nextAnimations = new Vector<Animation>(2);
private final LinkedHashSet<Tile> tilesToDraw = new LinkedHashSet<Tile>();
@@ -78,8 +83,32 @@ public abstract class Board extends Image implements Disposable
nextAnimations.add(seq);
}
+ private void stats()
+ {
+ boolean print = false;
+
+ if (tileCount != tilesToDraw.size()) {
+ tileCount = tilesToDraw.size();
+ print = true;
+ }
+
+ if (pawnCount != pawnsToDraw.size()) {
+ pawnCount = pawnsToDraw.size();
+ print = true;
+ }
+
+ if (animationCount != animations.size()) {
+ animationCount = animations.size();
+ print = true;
+ }
+
+ if (print)
+ Gdx.app.debug("Board", " tiles:" + tileCount + " pawns:" + pawnCount + " animations:" + animationCount);
+ }
+
public void animate(float delta)
{
+
Iterator<Animation> iter = animations.iterator();
while (iter.hasNext()) {
Animation a = iter.next();
@@ -122,6 +151,7 @@ public abstract class Board extends Image implements Disposable
@Override
public void drawDebug(ShapeRenderer debugShapes)
{
+ stats();
if (transform) {
prevTransform.set(debugShapes.getTransformMatrix());
debugShapes.setTransformMatrix(nextTransform);