summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/StackedImages.java66
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);