diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-04 11:37:41 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-04 11:37:41 +0100 |
commit | 6d679e2f77cd35ea3e8e6cc4e3315b87afe43114 (patch) | |
tree | 4096ef1b2f5feabf763f764992c620feee481cb0 /core/src/ch/asynk/tankontank | |
parent | bcc59be0f6af5dcab805ed0fa251bbc4bda05742 (diff) | |
download | RustAndDust-6d679e2f77cd35ea3e8e6cc4e3315b87afe43114.zip RustAndDust-6d679e2f77cd35ea3e8e6cc4e3315b87afe43114.tar.gz |
hud...: replace contains(float, float) with hit(float, float)
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/gfx/Image.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hud.java | 14 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/Bg.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/UnitDock.java | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/Image.java b/core/src/ch/asynk/tankontank/engine/gfx/Image.java index 64063a6..1386679 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/Image.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/Image.java @@ -36,7 +36,7 @@ public class Image extends Sprite implements Drawable, Disposable if (texture != null) texture.dispose(); } - public boolean contains(float x, float y) + public boolean hit(float x, float y) { if (!visible) return false; return ((x >= getX()) && (y >= getY()) && (x <= (getX() + getWidth())) && (y <= (getY() + getHeight()))); diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index 2a72ea1..62a184e 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -213,10 +213,10 @@ public class Hud implements Disposable public boolean touchDown(float x, float y) { - if (reinforcement.contains(x,y) || unitDock.contains(x, y)) return true; + if (reinforcement.hit(x,y) || unitDock.hit(x, y)) return true; else unitDock.hide(); - if (turns.contains(x,y)) return true; - if (!actionsBg.contains(x,y)) return false; + if (turns.hit(x,y)) return true; + if (!actionsBg.hit(x,y)) return false; btn = null; @@ -244,22 +244,22 @@ public class Hud implements Disposable if (btn != null) btn.setOn(); - if (turns.contains(x,y)) { + if (turns.hit(x, y)) { ctrl.endPlayerTurn(); return true; } - if (reinforcement.contains(x,y)) { + if (reinforcement.hit(x, y)) { unitDock.toggle(); return true; } - if (unitDock.contains(x,y)) { + if (unitDock.hit(x, y)) { System.err.println("TODO unitDock touched"); return true; } - if (!actionsBg.contains(x,y)) return false; + if (!actionsBg.hit(x, y)) return false; if (btn == moveBtn) ctrl.setState(State.StateType.MOVE); diff --git a/core/src/ch/asynk/tankontank/game/hud/Bg.java b/core/src/ch/asynk/tankontank/game/hud/Bg.java index f862088..c88b985 100644 --- a/core/src/ch/asynk/tankontank/game/hud/Bg.java +++ b/core/src/ch/asynk/tankontank/game/hud/Bg.java @@ -27,7 +27,7 @@ public class Bg implements Drawable, Disposable rect.height = h; } - public boolean contains(float x, float y) + public boolean hit(float x, float y) { return rect.contains(x, y); } diff --git a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java index c111165..5e76c8e 100644 --- a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java +++ b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java @@ -70,7 +70,7 @@ public class UnitDock extends Bg } @Override - public boolean contains(float x, float y) + public boolean hit(float x, float y) { return scaledRect.contains(x, y); } |