I’m having trouble understanding how controllers work in Nifty. I tried to get my Player class to modify the gui, but I couldn’t get it and I can’t tell what went wrong.
Could someone please explain how to use controllers?
Note: I’ve already looked at most of the relevant wiki here. I followed whatever I could, but I couldn’t understand exactly what was going on in some parts.
There’s more than one way to do use Nifty controllers in JME. What I usually do is to create an appstate for each screen. A screen is displayed if and only if its appstate is enabled. Most of the relevant code is here:
For each screen, create a BasicScreenController (or an instance of some class that extends it). If you’re using XML, reference the controller’s fully-qualified classname in the screen layout like so: