From: JBM Date: Wed, 27 May 2020 16:36:35 +0000 (+0200) Subject: More debug utility X-Git-Url: https://troll.desast.re/troll.git/commitdiff_plain/643a6e62e19c389a7a0da3176af340228a52d3ab?hp=a9282d24ea6494c71a002bf99d8f9a5bd516db35 More debug utility --- diff --git a/config/statement_en.html b/config/statement_en.html index db798d1..9d827a3 100644 --- a/config/statement_en.html +++ b/config/statement_en.html @@ -137,7 +137,7 @@

This draft's last change is: - add some mountains. + more debug utility.

diff --git a/src/main/java/com/codingame/game/View.java b/src/main/java/com/codingame/game/View.java index 13ac93f..29570b6 100644 --- a/src/main/java/com/codingame/game/View.java +++ b/src/main/java/com/codingame/game/View.java @@ -193,6 +193,7 @@ class View { Sprite troll; Text trollPositionGauge; Player p0 = new Player(), p1 = new Player(); + Text turnCounter; int _turns = 0; void init(Model m) { model = m; @@ -218,6 +219,8 @@ class View { void startTurn() { p0.startTurn(); p1.startTurn(); + + animateTurnCounter(); } private class Pos { @@ -341,6 +344,15 @@ class View { trollPositionGauge.setX(troll.getX()); } + void animateTurnCounter() { + for (int i = 0; i < 10; i++) { + turnCounter.setText("T" + _turns + "." + i); + // The following line is likely not a bug. + graphicEntityModule.commitEntityState((double) i/9, turnCounter); + } + _turns++; + } + void drawDebug() { String[] debugModePngs = graphicEntityModule.createSpriteSheetSplitter() .setSourceImage("debug.png") @@ -359,5 +371,18 @@ class View { .setAnchorX(0.5) .setLoop(true); toggleModule.displayOnToggleState(debugMode, "debug", true); + + turnCounter = graphicEntityModule.createText() + .setAnchorX(0.5) + .setAnchorY(0) + .setX(1920 / 2) + .setY(280) + .setStrokeColor(0xff0080) + .setFillColor(0xff0080) + .setFontFamily("monospace") + .setFontWeight(Text.FontWeight.BOLD) + .setFontSize(100); + toggleModule.displayOnToggleState(turnCounter, "debug", true); + animateTurnCounter(); } }