From 126c2da904afc5d36184fdbe646642bb9e652211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 9 Nov 2015 23:50:44 +0100 Subject: DicAnimation: dimension has to be given at construction --- .../rustanddust/engine/gfx/animations/DiceAnimation.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java b/core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java index 1a0a3bb..e5a1a02 100644 --- a/core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java +++ b/core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java @@ -15,7 +15,6 @@ public class DiceAnimation implements Animation, Drawable { private static final float DURATION = 0.7f; private static final float DURATION_SCATTERING = 0.5f; - private static final int DICE_DIMENSION = 24; private static Random random = new Random(); private static Sprites dice; @@ -37,8 +36,14 @@ public class DiceAnimation implements Animation, Drawable private int[] roll; private float elapsed; private float duration; + private int dimension; // public boolean stop; + public DiceAnimation(int dimension) + { + this.dimension = dimension; + } + public static void init(Texture texture, int cols, int rows, Sound s) { dice = new Sprites(texture, cols, rows); @@ -76,12 +81,12 @@ public class DiceAnimation implements Animation, Drawable public int getWidth() { - return DICE_DIMENSION; + return dimension; } public int getHeight() { - return DICE_DIMENSION; + return dimension; } public void setPosition(float x, float y) @@ -130,7 +135,7 @@ public class DiceAnimation implements Animation, Drawable @Override public void draw(Batch batch) { - batch.draw(dice.frames[frame], x, y, DICE_DIMENSION, DICE_DIMENSION); + batch.draw(dice.frames[frame], x, y, dimension, dimension); } @Override -- cgit v1.1-2-g2b99