summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-17 09:45:22 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-17 09:45:22 +0200
commit9146d50cc14c983a13a22b95e6fba5399fd5f514 (patch)
tree589dd0bc569c4a40cda52c740cca1e4c09dab0f1 /core
parentf8d7d57a1fdd661b4e771e80d045c12ea57f9725 (diff)
downloadRustAndDust-9146d50cc14c983a13a22b95e6fba5399fd5f514.zip
RustAndDust-9146d50cc14c983a13a22b95e6fba5399fd5f514.tar.gz
Image: add contains(float, float)
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/Image.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/Image.java b/core/src/ch/asynk/tankontank/engine/gfx/Image.java
index 282e03b..5797655 100644
--- a/core/src/ch/asynk/tankontank/engine/gfx/Image.java
+++ b/core/src/ch/asynk/tankontank/engine/gfx/Image.java
@@ -32,6 +32,11 @@ public class Image extends Sprite implements Drawable, Disposable
if (texture != null) texture.dispose();
}
+ public boolean contains(float x, float y)
+ {
+ return ((x >= getX()) && (y >= getY()) && (x <= (getX() + getWidth())) && (y <= (getY() + getHeight())));
+ }
+
public void setPosition(float x, float y, float r)
{
setPosition(x, y);