X-Git-Url: https://troll.desast.re/troll.git/blobdiff_plain/bee7b9453170b158a412d84533070f837e2cdad5..643a6e62e19c389a7a0da3176af340228a52d3ab:/src/main/java/com/codingame/game/View.java?ds=inline 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(); } }