From 247f2e0ccf2563d5d67081608b870bd08a24c93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 8 Oct 2018 15:20:00 +0200 Subject: Drawable,Paddable,Posisionable,Scalable : split interfaces --- core/src/ch/asynk/gdx/boardgame/Drawable.java | 9 --------- core/src/ch/asynk/gdx/boardgame/Paddable.java | 11 +++++++++++ core/src/ch/asynk/gdx/boardgame/Positionable.java | 10 ++++++++++ core/src/ch/asynk/gdx/boardgame/Scalable.java | 6 ++++++ core/src/ch/asynk/gdx/boardgame/ui/Element.java | 6 ++++-- 5 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 core/src/ch/asynk/gdx/boardgame/Paddable.java create mode 100644 core/src/ch/asynk/gdx/boardgame/Positionable.java create mode 100644 core/src/ch/asynk/gdx/boardgame/Scalable.java diff --git a/core/src/ch/asynk/gdx/boardgame/Drawable.java b/core/src/ch/asynk/gdx/boardgame/Drawable.java index 618d6a2..8c53e62 100644 --- a/core/src/ch/asynk/gdx/boardgame/Drawable.java +++ b/core/src/ch/asynk/gdx/boardgame/Drawable.java @@ -5,15 +5,6 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer; public interface Drawable { - public float getX(); - public float getY(); - public float getWidth(); - public float getHeight(); - public float getInnerX(); - public float getInnerY(); - public float getInnerWidth(); - public float getInnerHeight(); public void draw(Batch batch); default public void drawDebug(ShapeRenderer debugShapes) { } - public void setPosition(float x, float y, float w, float h); } diff --git a/core/src/ch/asynk/gdx/boardgame/Paddable.java b/core/src/ch/asynk/gdx/boardgame/Paddable.java new file mode 100644 index 0000000..344c4ff --- /dev/null +++ b/core/src/ch/asynk/gdx/boardgame/Paddable.java @@ -0,0 +1,11 @@ +package ch.asynk.gdx.boardgame; + +public interface Paddable +{ + public float getInnerX(); + public float getInnerY(); + public float getInnerWidth(); + public float getInnerHeight(); + public void setPadding(float padding); +} + diff --git a/core/src/ch/asynk/gdx/boardgame/Positionable.java b/core/src/ch/asynk/gdx/boardgame/Positionable.java new file mode 100644 index 0000000..d16f5ce --- /dev/null +++ b/core/src/ch/asynk/gdx/boardgame/Positionable.java @@ -0,0 +1,10 @@ +package ch.asynk.gdx.boardgame; + +public interface Positionable +{ + public float getX(); + public float getY(); + public float getWidth(); + public float getHeight(); + public void setPosition(float x, float y, float w, float h); +} diff --git a/core/src/ch/asynk/gdx/boardgame/Scalable.java b/core/src/ch/asynk/gdx/boardgame/Scalable.java new file mode 100644 index 0000000..cf430ca --- /dev/null +++ b/core/src/ch/asynk/gdx/boardgame/Scalable.java @@ -0,0 +1,6 @@ +package ch.asynk.gdx.boardgame; + +public interface Scalable extends Drawable +{ + public void setScale(float scale); +} diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Element.java b/core/src/ch/asynk/gdx/boardgame/ui/Element.java index 25f38eb..5f5fcb3 100644 --- a/core/src/ch/asynk/gdx/boardgame/ui/Element.java +++ b/core/src/ch/asynk/gdx/boardgame/ui/Element.java @@ -4,9 +4,11 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Rectangle; import ch.asynk.gdx.boardgame.Drawable; +import ch.asynk.gdx.boardgame.Paddable; +import ch.asynk.gdx.boardgame.Positionable; import ch.asynk.gdx.boardgame.Touchable; -public abstract class Element implements Drawable, Touchable +public abstract class Element implements Drawable, Paddable, Positionable, Touchable { public boolean blocked; public boolean visible; @@ -71,7 +73,7 @@ public abstract class Element implements Drawable, Touchable this.tainted = true; } - public void setPadding(float padding) + @Override public void setPadding(float padding) { this.padding = padding; this.tainted = true; -- cgit v1.1-2-g2b99