diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-09-11 19:57:35 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-09-11 19:57:35 +0200 |
commit | de8b651b8d3b8f22d8bbad1a968d2e2a2ca14f36 (patch) | |
tree | bb1ee499a001e584ba225a3ef22a5e28d917f5d0 | |
parent | 9c3f62417a577618d52b7458a99413bde6f9a901 (diff) | |
download | gdx-boardgame-de8b651b8d3b8f22d8bbad1a968d2e2a2ca14f36.zip gdx-boardgame-de8b651b8d3b8f22d8bbad1a968d2e2a2ca14f36.tar.gz |
Assembly : track touched Element
-rw-r--r-- | core/src/ch/asynk/zproject/engine/ui/Assembly.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/src/ch/asynk/zproject/engine/ui/Assembly.java b/core/src/ch/asynk/zproject/engine/ui/Assembly.java index a8f00ab..3a52acd 100644 --- a/core/src/ch/asynk/zproject/engine/ui/Assembly.java +++ b/core/src/ch/asynk/zproject/engine/ui/Assembly.java @@ -8,6 +8,7 @@ import ch.asynk.zproject.engine.util.IterableSet; public abstract class Assembly extends Element { private IterableSet<Element> children; + private Element touched; public Assembly(int c) { @@ -28,11 +29,19 @@ public abstract class Assembly extends Element } } + public Element touched() + { + return touched; + } + @Override public boolean touch(float x, float y) { for (Element e : children) - if (e.touch(x, y)) + if (e.touch(x, y)) { + touched = e; return true; + } + touched = null; return false; } |