diff options
Diffstat (limited to 'core/src/ch')
14 files changed, 65 insertions, 46 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java index 904a139..dff4df2 100644 --- a/core/src/ch/asynk/tankontank/TankOnTank.java +++ b/core/src/ch/asynk/tankontank/TankOnTank.java @@ -21,11 +21,21 @@ public class TankOnTank extends Game public Ctrl ctrl; public Config config; + public static void debug(String msg) + { + debug("", msg); + } + + public static void debug(String dom, String msg) + { + Gdx.app.debug(dom, msg); + } + @Override public void create () { Gdx.app.setLogLevel(Gdx.app.LOG_DEBUG); - Gdx.app.debug("TankOnTank", "create() [" + Gdx.graphics.getWidth() + ";" + Gdx.graphics.getHeight() + "]"); + debug("TankOnTank", "create() [" + Gdx.graphics.getWidth() + ";" + Gdx.graphics.getHeight() + "]"); manager = new AssetManager(); factory = new Factory(this); @@ -37,7 +47,7 @@ public class TankOnTank extends Game public void loadAssets() { - Gdx.app.debug("TankOnTank", " load assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB"); + debug("TankOnTank", " load assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB"); manager.load("data/map_a.png", Texture.class); manager.load("data/map_b.png", Texture.class); manager.load("data/hud.atlas", TextureAtlas.class); @@ -52,8 +62,8 @@ public class TankOnTank extends Game public void unloadAssets() { - Gdx.app.debug("TankOnTank", "unload assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB"); - Gdx.app.debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() ); + debug("TankOnTank", "unload assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB"); + debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() ); manager.unload("data/map_a.png"); manager.unload("data/map_b.png"); manager.unload("data/hud.atlas"); @@ -64,7 +74,7 @@ public class TankOnTank extends Game manager.unload("data/explosions.png"); manager.unload("sounds/move.mp3"); manager.unload("sounds/attack.mp3"); - Gdx.app.debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() ); + debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() ); } public void onLoaded() @@ -83,14 +93,14 @@ public class TankOnTank extends Game // @Override // public void resize(int width, int height) // { - // Gdx.app.debug("TankOnTank", "resize(" + width + ", " + height + ")"); + // debug("TankOnTank", "resize(" + width + ", " + height + ")"); // super.resize(width, height); // } @Override public void dispose() { - Gdx.app.debug("TankOnTank", "dispose()"); + debug("TankOnTank", "dispose()"); getScreen().dispose(); factory.dispose(); unloadAssets(); @@ -99,12 +109,12 @@ public class TankOnTank extends Game // @Override // public void pause() // { - // Gdx.app.debug("TankOnTank", "pause()"); + // debug("TankOnTank", "pause()"); // } // @Override // public void resume() // { - // Gdx.app.debug("TankOnTank", "resume()"); + // debug("TankOnTank", "resume()"); // } } diff --git a/core/src/ch/asynk/tankontank/engine/Player.java b/core/src/ch/asynk/tankontank/engine/Player.java index fa6a923..180df43 100644 --- a/core/src/ch/asynk/tankontank/engine/Player.java +++ b/core/src/ch/asynk/tankontank/engine/Player.java @@ -81,7 +81,6 @@ public abstract class Player { units.remove(pawn); casualties.add(pawn); - System.err.println(" casualty : " + pawn); } public Iterator<Pawn> unitIterator() diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index cc724fb..25e4e62 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -88,7 +88,6 @@ public class Ctrl implements Disposable public void setAnimationCount(int count) { animationCount = count; - System.err.println(" setAnimationCount(" + count + ")"); } public void animationDone() @@ -97,14 +96,14 @@ public class Ctrl implements Disposable if (animationCount == 0) state.done(); if (animationCount < 0) - System.err.println(" animationCount < 0"); + TankOnTank.debug(" animationCount < 0"); } private void nextPlayer() { player.turnEnd(); if (battle.checkVictory(this)) { - System.err.println("TODO " + player + " has won !!!!!!!!!!!"); + TankOnTank.debug("TODO " + player + " has won !!!!!!!!!!!"); } Player tmp = player; player = opponent; @@ -140,7 +139,7 @@ public class Ctrl implements Disposable hud.changeState(stateType, state); this.state.leave(state); - System.err.println(" switch to : " + state + " " + normal); + TankOnTank.debug(" switch to : " + state + " " + normal); switch(state) { case SELECT: this.state = selectState; diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 351fd46..8e5f893 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -204,7 +204,7 @@ public abstract class Map extends Board public void revertMoves() { - System.err.println(" revertMoves()"); + TankOnTank.debug(" revertMoves()"); for (Pawn pawn : activatedPawns) { revertLastPawnMove(pawn, notifyDoneAnimation(pawn)); } @@ -232,7 +232,7 @@ public abstract class Map extends Board private void animationDone() { - System.err.println("animation done"); + TankOnTank.debug("animation done"); if (soundId >= 0) addAnimation( SoundAnimation.get(SoundAnimation.Action.FADE_OUT, sound, soundId, 0.5f)); soundId = -1; @@ -263,7 +263,7 @@ public abstract class Map extends Board int def = target.getTile().defenseFor(pawn, target, activatedPawns); success = ((dice + activatedUnits + flankAttacks) >= def); } - System.err.println(pawn + " attacks " + target + " : " + pawn.attack.calculus); + TankOnTank.debug(pawn + " attacks " + target + " : " + pawn.attack.calculus); AnimationSequence seq = AnimationSequence.get(2); if (success) { diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java index e484749..2a6e5a9 100644 --- a/core/src/ch/asynk/tankontank/game/Player.java +++ b/core/src/ch/asynk/tankontank/game/Player.java @@ -46,7 +46,7 @@ public class Player extends ch.asynk.tankontank.engine.Player public void burnDownOneAp() { apSpent += 1; - if (apSpent > actionPoints) System.err.println("ERROR: spent too much AP, please report"); + if (apSpent > actionPoints) TankOnTank.debug("ERROR: spent too much AP, please report"); } @Override diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index 1bccde9..3e5052e 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -8,6 +8,8 @@ import ch.asynk.tankontank.engine.Tile; import ch.asynk.tankontank.engine.HeadedPawn; import ch.asynk.tankontank.engine.Orientation; +import ch.asynk.tankontank.TankOnTank; + public class Unit extends HeadedPawn { public static final int MOVE = 0; @@ -200,8 +202,8 @@ public class Unit extends HeadedPawn @Override public void move() { - System.err.println(move.toString()); - if (move.cost > mpLeft) System.err.println("ERROR: Movement point exceeded: " + move.cost + "/" + mpLeft + " please report"); + TankOnTank.debug(move.toString()); + if (move.cost > mpLeft) TankOnTank.debug("ERROR: Movement point exceeded: " + move.cost + "/" + mpLeft + " please report"); if (!move.entryMove) { hasMoved = true; @@ -212,7 +214,7 @@ public class Unit extends HeadedPawn @Override public void attack() { - System.err.println(attack.toString()); + TankOnTank.debug(attack.toString()); hasFired = true; } diff --git a/core/src/ch/asynk/tankontank/game/hud/Msg.java b/core/src/ch/asynk/tankontank/game/hud/Msg.java index 5eb3c5c..765a429 100644 --- a/core/src/ch/asynk/tankontank/game/hud/Msg.java +++ b/core/src/ch/asynk/tankontank/game/hud/Msg.java @@ -2,12 +2,13 @@ package ch.asynk.tankontank.game.hud; import java.util.ArrayDeque; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds; +import ch.asynk.tankontank.TankOnTank; + public class Msg extends Bg { class MsgInfo @@ -114,7 +115,7 @@ public class Msg extends Bg visible = false; if (stack.size() > 0) { MsgInfo info = stack.pop(); - System.err.println(info); + TankOnTank.debug(info.text); write(info.text, info.duration, info.position); } } diff --git a/core/src/ch/asynk/tankontank/game/states/StateAttack.java b/core/src/ch/asynk/tankontank/game/states/StateAttack.java index 20243a9..80c240b 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateAttack.java +++ b/core/src/ch/asynk/tankontank/game/states/StateAttack.java @@ -2,6 +2,8 @@ package ch.asynk.tankontank.game.states; import ch.asynk.tankontank.game.Unit; +import ch.asynk.tankontank.TankOnTank; + public class StateAttack extends StateCommon { @Override @@ -26,7 +28,7 @@ public class StateAttack extends StateCommon selectedUnit.showAttack(); map.selectHex(selectedHex); } else - System.err.println("should not happen"); + TankOnTank.debug("should not happen"); } @Override diff --git a/core/src/ch/asynk/tankontank/game/states/StateBreak.java b/core/src/ch/asynk/tankontank/game/states/StateBreak.java index ac7aea4..fa3023f 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateBreak.java +++ b/core/src/ch/asynk/tankontank/game/states/StateBreak.java @@ -3,6 +3,8 @@ package ch.asynk.tankontank.game.states; import ch.asynk.tankontank.engine.Orientation; import ch.asynk.tankontank.game.Unit; +import ch.asynk.tankontank.TankOnTank; + public class StateBreak extends StateCommon { private boolean done; @@ -82,6 +84,6 @@ public class StateBreak extends StateCommon ctrl.setAnimationCount(1); ctrl.setState(StateType.ANIMATION); } else - System.err.println("That's very wrong there should be only one path"); + TankOnTank.debug("That's very wrong there should be only one path"); } } diff --git a/core/src/ch/asynk/tankontank/game/states/StateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java index cb89b82..9bf6ac7 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateCommon.java +++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java @@ -6,6 +6,8 @@ import ch.asynk.tankontank.game.Unit; import ch.asynk.tankontank.game.Ctrl; import ch.asynk.tankontank.game.State; +import ch.asynk.tankontank.TankOnTank; + public abstract class StateCommon implements State { protected static Ctrl ctrl; @@ -98,7 +100,7 @@ public abstract class StateCommon implements State isEnemy = ctrl.player.isEnemy(selectedUnit); else isEnemy = false; - System.err.println(" select " + selectedHex + selectedUnit + (isEnemy ? " enemy " : " friend ")); + TankOnTank.debug(" select " + selectedHex + selectedUnit + (isEnemy ? " enemy " : " friend ")); } protected void showPossibleTargetsMovesAssists(Unit pawn) diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index 1b682c8..b35a856 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -2,6 +2,8 @@ package ch.asynk.tankontank.game.states; import ch.asynk.tankontank.engine.Orientation; +import ch.asynk.tankontank.TankOnTank; + public class StateRotate extends StateCommon { private boolean rotateOnly; @@ -23,7 +25,7 @@ public class StateRotate extends StateCommon to = activeUnit.getHex(); } else { if (to == null) - System.err.println("to is null but should not be"); + TankOnTank.debug("to is null but should not be"); map.showFinalPath(to); } diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index a139b6c..99cfaac 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -224,7 +224,7 @@ public class GameScreen implements Screen @Override public void resize(int width, int height) { - // Gdx.app.debug("GameScreen", "resize (" + width + "," + height + ")"); + // TankOnTank.debug("GameScreen", "resize (" + width + "," + height + ")"); mapViewport.update(width, height); // hudViewport.update(width, height); @@ -237,7 +237,7 @@ public class GameScreen implements Screen @Override public void dispose() { - // Gdx.app.debug("GameScreen", "dispose()"); + // TankOnTank.debug("GameScreen", "dispose()"); mapBatch.dispose(); hudBatch.dispose(); ctrl.dispose(); @@ -247,24 +247,24 @@ public class GameScreen implements Screen @Override public void show() { - // Gdx.app.debug("GameScreen", "show()"); + // TankOnTank.debug("GameScreen", "show()"); } @Override public void hide() { - // Gdx.app.debug("GameScreen", "hide()"); + // TankOnTank.debug("GameScreen", "hide()"); } @Override public void pause() { - // Gdx.app.debug("GameScreen", "pause()"); + // TankOnTank.debug("GameScreen", "pause()"); } @Override public void resume() { - // Gdx.app.debug("GameScreen", "resume()"); + // TankOnTank.debug("GameScreen", "resume()"); } } diff --git a/core/src/ch/asynk/tankontank/screens/LoadScreen.java b/core/src/ch/asynk/tankontank/screens/LoadScreen.java index 6883f7b..7ae88aa 100644 --- a/core/src/ch/asynk/tankontank/screens/LoadScreen.java +++ b/core/src/ch/asynk/tankontank/screens/LoadScreen.java @@ -47,7 +47,7 @@ public class LoadScreen implements Screen if (game.manager.update()) { delay += delta; if (delay >= 0.2f) { - Gdx.app.debug("LoadScreen", "assets loaded : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB"); + TankOnTank.debug("LoadScreen", "assets loaded : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB"); game.onLoaded(); game.setScreen(new OptionsScreen(game)); dispose(); @@ -68,7 +68,7 @@ public class LoadScreen implements Screen @Override public void show() { - Gdx.app.debug("LoadScreen", "show()"); + TankOnTank.debug("LoadScreen", "show()"); game.manager.load("loading.pack", TextureAtlas.class); game.manager.finishLoading(); @@ -101,7 +101,7 @@ public class LoadScreen implements Screen @Override public void resize(int width, int height) { - // Gdx.app.debug("LoadScreen", "resize (" + width + "," + height + ")"); + // TankOnTank.debug("LoadScreen", "resize (" + width + "," + height + ")"); stage.getViewport().update(width, height, true); @@ -129,26 +129,26 @@ public class LoadScreen implements Screen @Override public void dispose() { - // Gdx.app.debug("LoadScreen", "dispose()"); + // TankOnTank.debug("LoadScreen", "dispose()"); stage.dispose(); } @Override public void hide() { - // Gdx.app.debug("LoadScreen", "hide()"); + // TankOnTank.debug("LoadScreen", "hide()"); game.manager.unload("loading.pack"); } @Override public void pause() { - // Gdx.app.debug("LoadScreen", "pause()"); + // TankOnTank.debug("LoadScreen", "pause()"); } @Override public void resume() { - // Gdx.app.debug("LoadScreen", "resume()"); + // TankOnTank.debug("LoadScreen", "resume()"); } } diff --git a/core/src/ch/asynk/tankontank/screens/OptionsScreen.java b/core/src/ch/asynk/tankontank/screens/OptionsScreen.java index c1b0076..365a855 100644 --- a/core/src/ch/asynk/tankontank/screens/OptionsScreen.java +++ b/core/src/ch/asynk/tankontank/screens/OptionsScreen.java @@ -54,7 +54,7 @@ public class OptionsScreen implements Screen @Override public void show() { - Gdx.app.debug("OptionsScreen", "show()"); + TankOnTank.debug("OptionsScreen", "show()"); stage = new Stage(new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); Gdx.input.setInputProcessor(stage); @@ -98,7 +98,7 @@ public class OptionsScreen implements Screen @Override public void resize(int width, int height) { - // Gdx.app.debug("OptionsScreen", "resize (" + width + "," + height + ")"); + // TankOnTank.debug("OptionsScreen", "resize (" + width + "," + height + ")"); stage.getViewport().update(width, height, true); @@ -125,25 +125,25 @@ public class OptionsScreen implements Screen @Override public void dispose() { - // Gdx.app.debug("LoadScreen", "dispose()"); + // TankOnTank.debug("LoadScreen", "dispose()"); stage.dispose(); } @Override public void hide() { - // Gdx.app.debug("LoadScreen", "hide()"); + // TankOnTank.debug("LoadScreen", "hide()"); } @Override public void pause() { - // Gdx.app.debug("LoadScreen", "pause()"); + // TankOnTank.debug("LoadScreen", "pause()"); } @Override public void resume() { - // Gdx.app.debug("LoadScreen", "resume()"); + // TankOnTank.debug("LoadScreen", "resume()"); } } |