I dont understand why nifty controls are not given the main application variable
what’s the point of clicking a button if it’s action stays in the realm of the gui ???
I need to communicate with game appstates for instance
public class CommandButtonController implements Controller
{
private Nifty nifty;
private Element element;
private Screen screen;
public void bind(final Nifty nifty,final Screen screenParam,final Element element,final Properties parameter,final ControllerEventListener listener,final Attributes controlDefinitionAttributes)
{
what about app ???
}
Nifty isn’t jME specific so it doesn’t use jME-specific classes. You can easily pass anything via a constructor or by implementing AppState as well though.
it is only possible with screencontrollers
nifty.registerScreenController(new OptionsScreenController(randomConstructorArgument));
nifty.addXml(“Interface/Screens/OptionsScreen.xml”);
not with controls AFAIK
Yeah, it is only screen controllers that you can inject this way. I guess the screen controller could go through all of the elements on bind and inject other stuff.
I don’t know, really, as I stopped using nifty like 3 years ago or more and never looked back.
I wrote Lemur as my own nifty replacement… though it aims at a slightly different target. There is also JavaFX and tonegodGUI.
If you end up being curious, Lemur related links are here:
It does 3D or 2D guis.
I used it for all of these, for example:
And the HUDs for things like SimArboreal (and most of my other demos, actually):
It tries to be the components to implement other GUIs on top of by having several modular pieces. It still doesn’t implement every GUI control yet (no combo box yet, for example).
JavaFX is probably the most ‘mature’ alternative to nifty right now… but it’s strictly 2D.