I'm trying to get Nifty GUI to work with Slick2D. So far everything is going great, except that I can't seem to figure out how to properly interact with the GUI. I'm trying the example in the nifty manual http://sourceforge.n....0.pdf/download
but it doesn't seem to entirely work.

The Element controller is being called for bind(...), init(...) and onStartScreen() as it should, as I can see their println output, but the next() method isn't being called when I click on the GUI element that I assigned the controller to, nor the screen controller as no output from println is shown.

What's weird is, that the player is moving, so the mouse input is working.
It's supposed to be called when I click the mouse button on it from the in the XML.

1 Answer
1

Sorry, I do not keep track on the quests asked here.
For support on the Nifty-GUI and on Slick best use the boards of Slick2D and Nifty-GUI to ask your questions.

How ever in case your question is still relevant, you shall get your answer.

To enable the Nifty-GUI to receive mouse and keyboard you have to forward all events arriving in Slick2D to the Nifty-GUI. This is a pretty major task as Slick2D and Nifty-GUI have separated polling times for this events. So you basically have to buffer the events from Slick2D and forward them to Nifty-GUI upon request.

How ever you are using the PlainSlickInputSystem that basically has this functionality already included. In order to hook it into Slick properly you need to do the following:

Once you did so the PlainSlickInputSystem will take care for relaying the input events from Slick to Nifty.

How ever I propse that you make use of the Game, BasicGame, GameState and BasicGameState implementations that are delivered along with the Slick2D-render library for Nifty. Those classes implement the default Slick classes with there respective names and add all functionality to display and use the Nifty-GUI. The entire initialization is done more or less automatically. Updating and rendering is done automatically as well.