Problems with nifty and Events

Hello fellow monkeys!

First of all a bit of praise to the developers of this engine (who seem to frequent the forums also - which is also praiseworthy!) for the work that you’ve obviously put into this engine! I just finnished a project where I build a game engine using JOGL and java alone and coming from that into here is just bliss. After a few weeks of experementing I’ve really come to like this engine, and I can now focus on getting the game worknig instead of trying to optimize my glUniform-calls and remembering how to ray-trace :slight_smile:

Nevertheless, I have some problems. Having built a simple game I decided to build a login screen and a character selection screen. The process for logging in would be very similar to that of World of Warcraft (for those who know that). Log in using user name and password. A new screen pops up, where a character is chosen and then BAM you’re in the game. These two first menus occupy an area as high as the game window and 80% of the width (so there are black borders on the sides).

I built these things using NIfty (what a gift from the gods! I had to create all these things manually before!) and had them up and running! I attach them as SceneProcessors and once they are removed from view I remove them again. Now comes my problem. When finally getting to the ingame view nifty eats all of my mouse inputs that occur within the area previously covered by these screens. (anything except what was previously border). I’ve viewed them using the debugColor setting set to true and there really is no component there.

I dug into the code a bit and found that the NiftyJmeDisplay refgsters an RawInputListener on creation which is never unregistered. So, in my game view I simply deattached all rawInputLIsteners before starting to add my own. That worked! But now the menues no longer have any listeners, so if I was to return to them (in case of connection lost or something) then they would not work. It seems I have to recreate them every time I want them to show, and this is not something that I want to do. Also, if I set the NiftyJmeDisplay to null, then wont the listener still survive the GC since the inputSys still has it registered as a listener? So if I create a lot of these all the time, then won’t I have lots and lots of listeners?

Am I overlooking something here or have I stumbeled upon a bug? I have a workaround for now (removing all listeners and recreating) but perhaps there is a better way.

Help and suggestions are greatly appreciated!


Looks to me like a nifty gui bug. When you’re hiding the panel or screen, those things shouldn’t consume input anymore.

Hi, I have a similar problem.

I go to an empty screen to hide my menu:

[xml]<screen id=“end” controller=“application.Controller”>


But when I go to this screen, half of the mouse click inputs are still eaten by nifty. Exactly 50% of mouse clicks. It’s like application and nifty were doing shift work. Odd clicks are consumed by application, and even clicks are consumed by nifty. It doesn’t matter how much time passes between clicks, it’s always shiftwork while nifty is still running.

Why is nifty consuming input yet?


Yes, there was indeed a problem in Nifty that was unfortunately triggered by some new changes that Momoko_Fan did inside of the jME Renderer of Nifty. To be clear that was a Nifty problem and not an error by Momoko_Fan :slight_smile: It just didn’t happen before.

This bug has now been corrected in Nifty 1.3.1-SNAPSHOT (the nightly build of Nifty) and I think this version should be available soon in nightly builds of jME as well.

Sorry for the inconvience :slight_smile:

PS: In case someone is interessted in the details here is the direct link to the change with some details;a=commit;h=bf4afcce7274c0e8163a729de9e241ecb077868d