From 849b4301273f3460e9ac6c107823ad657aba065b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 12 Nov 2014 22:41:08 +0100 Subject: Config: add debug option --- core/src/ch/asynk/tankontank/game/Config.java | 2 ++ core/src/ch/asynk/tankontank/screens/GameScreen.java | 4 +++- core/src/ch/asynk/tankontank/screens/OptionsScreen.java | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/ch/asynk/tankontank/game/Config.java b/core/src/ch/asynk/tankontank/game/Config.java index c2f933a..dbbf7bf 100644 --- a/core/src/ch/asynk/tankontank/game/Config.java +++ b/core/src/ch/asynk/tankontank/game/Config.java @@ -8,9 +8,11 @@ public class Config public boolean canCancel; public boolean mustValidate; public boolean showEnemyPossibilities; + public boolean debug; public Config() { + this.debug = false; this.showMoves = true; this.showTargets = true; this.showMoveAssists = true; diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index 9e82764..739a3e3 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -30,7 +30,7 @@ import ch.asynk.tankontank.game.battles.BattleHeadToHead; public class GameScreen implements Screen { - private static final boolean DEBUG = false; + private static boolean DEBUG = false; private static final float INPUT_DELAY = 0.1f; private static final float ZOOM_IN_MAX = 0.3f; @@ -66,6 +66,8 @@ public class GameScreen implements Screen this.ctrl = new Ctrl(game, new BattleHeadToHead(game.factory)); + DEBUG = game.config.debug; + virtualWidth = ctrl.map.getWidth(); virtualHeight = ctrl.map.getHeight(); diff --git a/core/src/ch/asynk/tankontank/screens/OptionsScreen.java b/core/src/ch/asynk/tankontank/screens/OptionsScreen.java index 365a855..f7752ae 100644 --- a/core/src/ch/asynk/tankontank/screens/OptionsScreen.java +++ b/core/src/ch/asynk/tankontank/screens/OptionsScreen.java @@ -26,6 +26,7 @@ public class OptionsScreen implements Screen private CheckBox canCancelCk; private CheckBox mustValidateCk; private CheckBox showEnemyPossibilitiesCk; + private CheckBox debugCk; public OptionsScreen(final TankOnTank game) { @@ -49,6 +50,7 @@ public class OptionsScreen implements Screen game.config.canCancel = canCancelCk.isChecked(); game.config.mustValidate = mustValidateCk.isChecked(); game.config.showEnemyPossibilities = showEnemyPossibilitiesCk.isChecked(); + game.config.debug = debugCk.isChecked(); } @Override @@ -67,6 +69,7 @@ public class OptionsScreen implements Screen canCancelCk = new CheckBox("Can Cancel", game.skin); mustValidateCk = new CheckBox("Must Validate", game.skin); showEnemyPossibilitiesCk = new CheckBox("Show Enemy Possibilities", game.skin); + debugCk = new CheckBox("Debug", game.skin); showMovesCk.setChecked(game.config.showMoves); showTargetsCk.setChecked(game.config.showTargets); @@ -74,6 +77,7 @@ public class OptionsScreen implements Screen canCancelCk.setChecked(game.config.canCancel); mustValidateCk.setChecked(game.config.mustValidate); showEnemyPossibilitiesCk.setChecked(game.config.showEnemyPossibilities); + debugCk.setChecked(game.config.debug); okButton.addListener(new InputListener() { public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { @@ -92,6 +96,7 @@ public class OptionsScreen implements Screen stage.addActor(canCancelCk); stage.addActor(mustValidateCk); stage.addActor(showEnemyPossibilitiesCk); + stage.addActor(debugCk); stage.addActor(okButton); } @@ -117,6 +122,8 @@ public class OptionsScreen implements Screen mustValidateCk.setPosition(x, y); y -= 20f; showEnemyPossibilitiesCk.setPosition(x, y); + y -= 20f; + debugCk.setPosition(x, y); x += 200f; y -= 40f; okButton.setPosition(x, y); -- cgit v1.1-2-g2b99