diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-10 15:15:40 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-10 15:15:40 +0100 |
commit | d2b88f0233edae27148e89bba246f1b381246578 (patch) | |
tree | 29244abe75a9f11aa9782b4c2df44fce45c1b6b2 /core/src | |
parent | 40c3467c6c6838e347f0ea90703643d51de4a481 (diff) | |
download | RustAndDust-d2b88f0233edae27148e89bba246f1b381246578.zip RustAndDust-d2b88f0233edae27148e89bba246f1b381246578.tar.gz |
EngagementPanel: take care of dice dimension at construction
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/rustanddust/RustAndDust.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java | 15 |
2 files changed, 6 insertions, 11 deletions
diff --git a/core/src/ch/asynk/rustanddust/RustAndDust.java b/core/src/ch/asynk/rustanddust/RustAndDust.java index 67f300f..17ccc8f 100644 --- a/core/src/ch/asynk/rustanddust/RustAndDust.java +++ b/core/src/ch/asynk/rustanddust/RustAndDust.java @@ -18,7 +18,6 @@ import ch.asynk.rustanddust.game.Config; import ch.asynk.rustanddust.game.battles.Factory; import ch.asynk.rustanddust.ui.Bg; import ch.asynk.rustanddust.game.hud.UnitDock; -import ch.asynk.rustanddust.game.hud.EngagementPanel; public class RustAndDust extends Game { @@ -164,7 +163,6 @@ public class RustAndDust extends Game Bg.setScale(Math.max((h * 0.00125f), 1.0f)); UnitDock.setScale(Math.max((h * 0.0005f), 0.4f)); - EngagementPanel.setDiceDimension((int) Math.max((h * 0.03f), 24)); } private void unloadUiAssets() diff --git a/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java b/core/src/ch/asynk/rustanddust/game/hud/EngagementPanel.java index 30114ae..599383a 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() |