From d2b88f0233edae27148e89bba246f1b381246578 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Tue, 10 Nov 2015 15:15:40 +0100 Subject: EngagementPanel: take care of dice dimension at construction --- .../ch/asynk/rustanddust/game/hud/EngagementPanel.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'core/src/ch/asynk/rustanddust/game') diff --git a/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java b/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java index 30114ae2..599383ab 100644 --- a/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java +++ b/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java @@ -1,5 +1,6 @@ package ch.asynk.rustanddust.game.hud; +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.TextureAtlas; @@ -56,15 +57,11 @@ public class EngagementPanel extends Patch implements Animation this.defenseR = new Label(font); this.okBtn = new Bg(uiAtlas.findRegion("ok")); this.visible = false; - this.d1Animation = new DiceAnimation(DICE_DIMENSION); - this.d2Animation = new DiceAnimation(DICE_DIMENSION); - this.d3Animation = new DiceAnimation(DICE_DIMENSION); - this.d4Animation = new DiceAnimation(DICE_DIMENSION); - } - - public static void setDiceDimension(int dimension) - { - DICE_DIMENSION = dimension; + int d = (int) Math.max((Gdx.graphics.getWidth() * 0.03f), DICE_DIMENSION); + this.d1Animation = new DiceAnimation(d); + this.d2Animation = new DiceAnimation(d); + this.d3Animation = new DiceAnimation(d); + this.d4Animation = new DiceAnimation(d); } public void updatePosition() -- cgit v1.2.3