From 9146d50cc14c983a13a22b95e6fba5399fd5f514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 17 Oct 2014 09:45:22 +0200 Subject: Image: add contains(float, float) --- core/src/ch/asynk/tankontank/engine/gfx/Image.java | 5 +++++ 1 file changed, 5 insertions(+) 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); -- cgit v1.1-2-g2b99