From d67c6f267073265fba09c91a6e10e55138de91e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 8 Feb 2016 06:22:53 +0100 Subject: ui/Menu: implement boolean hit(int, int) --- core/src/ch/asynk/rustanddust/ui/Menu.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/ch/asynk/rustanddust/ui/Menu.java b/core/src/ch/asynk/rustanddust/ui/Menu.java index 78f5964..0ffc5f1 100644 --- a/core/src/ch/asynk/rustanddust/ui/Menu.java +++ b/core/src/ch/asynk/rustanddust/ui/Menu.java @@ -87,6 +87,18 @@ public class Menu extends Patch } @Override + public boolean hit(float x, float y) + { + for (int i = 0; i< menuItem.last(); i ++) { + if (labels[i].hit(x, y)) { + menuItem = menuItem.get(i); + return true; + } + } + return false; + } + + @Override public void draw(Batch batch) { if (!visible) return; -- cgit v1.1-2-g2b99