I’m developing in JME SDK 3.0RC2, using Nifty to provide a heads-up display (HUD) for my game.
The HUD includes a scrollPanel, and Nifty (very reasonably, I think) uses scroll wheel events to scroll
the scrollPanel whenever the mouse pointer is over the HUD.
I’ve written a custom camera control which uses scroll wheel events to dolly the camera in and out.
My control’s onAnalog() listener method gets scroll wheel events whenever the wheel turns,
regardless of the mouse location or whether Nifty used the event. I want to separate the two
functions, so I need my listener to ignore events which will be (or have been) used by Nifty.
How can I do this?
I can get the mouse position from the input manager, so perhaps I just need a clean way to
determine whether that position is in the HUD or not. (I could hardcode a test like x < 100, but that
would break if I ever changed the layout of the HUD, so it’s not what I’d call clean.) Is there a
method to test whether a viewport location is inside a particular Nifty element? Or failing that,
a method to measure the transparency of a pixel in the GUI viewport?
I’d appreciate any helpful pointers.