GUI and mouse listening

I have both an inputlistener for my GUI and my Mouse. the problem is that when i click say something on my gui it still responds within the game which i don't want. How can i find out from the gui input listener if it within one of the childs so i can tell the game mouse input to not do anything?

You probably want to have a couple of states and InputHandlers setup and when you switch to the in game state you setEnabled(false) on the menu handler.

What if you have the fenggui state and the game state running at the same time ?



So is there a way to inhibits all the other inputhandlers when fenggui receives an event ?

Found the trick !



Just test with this in your game inputhandler to know if it was a click on your GUI or not:


public static boolean testOverGui(int x, int y)
   {
      FengGUIGameState fengGUIGameState = ((FengGUIGameState)GameStateManager.getInstance().getChild("fengGUIGameState"));
      if(fengGUIGameState.getDisp().hashCode() == fengGUIGameState.getDisp().getWidget(x, y).hashCode()) return false;
      else return true;
   }