diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-02 23:42:03 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-02 23:42:03 +0200 |
commit | fd33d6367e23e7fb583dba78b9cde08dd2cb4b9d (patch) | |
tree | 1b14bf4dd7847fc38254154ffdc5cb2c7105250b /core | |
parent | ab3327fae0453620c74eb3148ca4d67201a7d826 (diff) | |
download | RustAndDust-fd33d6367e23e7fb583dba78b9cde08dd2cb4b9d.zip RustAndDust-fd33d6367e23e7fb583dba78b9cde08dd2cb4b9d.tar.gz |
StackedImages: is no longer a Moveable but a Drawable
it only implements
- setRotation(float r)
- translate(float dx, float dy)
- centerOn(float cx, float cy)
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java | 66 |
1 files changed, 8 insertions, 58 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java index 48f7daa..4f72f76 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java @@ -6,7 +6,7 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.utils.Array; -public class StackedImages implements Moveable +public class StackedImages implements Drawable { private boolean enabled[]; private Array<Sprite> sprites; @@ -28,88 +28,39 @@ public class StackedImages implements Moveable enabled[i] = enable; } - public boolean isEnabled() - { - for (int i = 0; i < sprites.size; i++) - if (enabled[i]) return true; - return false; - } - public boolean isEnabled(int i) { return enabled[i]; } - @Override - public float getX() - { - return sprites.get(0).getX(); - } - - @Override - public float getY() - { - return sprites.get(0).getY(); - } - - @Override - public float getWidth() - { - return sprites.get(0).getWidth(); - } - - @Override - public float getHeight() - { - return sprites.get(0).getHeight(); - } - - @Override - public float getRotation() + public boolean isEnabled() { - return sprites.get(0).getRotation(); + for (int i = 0; i < sprites.size; i++) + if (enabled[i]) return true; + return false; } - @Override public void setRotation(float r) { for (int i = 0, n = sprites.size; i < n; i++) sprites.get(i).setRotation(r); } - @Override public void translate(float dx, float dy) { for (int i = 0, n = sprites.size; i < n; i++) sprites.get(i).translate(dx, dy); } - @Override public void centerOn(float cx, float cy) { - float x = (cx - (getWidth() / 2f)); - float y = (cy - (getHeight() / 2f)); - for (int i = 0, n = sprites.size; i < n; i++) - setPosition(x, y); - } - - @Override - public void setPosition(float x, float y) - { - for (int i = 0, n = sprites.size; i < n; i++) - sprites.get(i).setPosition(x, y); - } - - @Override - public void setPosition(float x, float y, float r) - { - for (int i = 0; i < sprites.size; i++) { + for (int i = 0, n = sprites.size; i < n; i++) { + float x = (cx - (sprites.get(i).getWidth() / 2f)); + float y = (cy - (sprites.get(i).getHeight() / 2f)); sprites.get(i).setPosition(x, y); - sprites.get(i).setRotation(r); } } - @Override public void draw(Batch batch) { for (int i = 0, n = sprites.size; i < n; i++) { @@ -118,7 +69,6 @@ public class StackedImages implements Moveable } } - @Override public void drawDebug(ShapeRenderer shapes) { Sprite sprite = sprites.get(0); |