diff options
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/FramedSprite.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/FramedSprite.java b/core/src/ch/asynk/gdx/boardgame/FramedSprite.java index 33a6eb2..b09a3af 100644 --- a/core/src/ch/asynk/gdx/boardgame/FramedSprite.java +++ b/core/src/ch/asynk/gdx/boardgame/FramedSprite.java @@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.TextureRegion; -public class FramedSprite implements Drawable +public class FramedSprite implements Drawable, Positionable { private TextureRegion[][] frames; private TextureRegion frame; @@ -46,6 +46,37 @@ public class FramedSprite implements Drawable return frame; } + @Override public float getX() + { + return x; + } + + @Override public float getY() + { + return y; + } + + @Override public float getWidth() + { + return frame.getRegionWidth(); + } + + @Override public float getHeight() + { + return frame.getRegionHeight(); + } + + @Override public void translate(float dx, float dy) + { + setPosition(getX() + dx, getY() + dy); + } + + @Override public void setPosition(float x, float y) + { + this.x = x; + this.y = y; + } + @Override public void draw(Batch batch) { batch.draw(frame, x, y, 0, 0, frame.getRegionWidth(), frame.getRegionHeight(), 1f, 1f, a); |