NiftyAppState why isn't there one in jme3?

I am not saying it is necessary or anything but I have been using one and it is really convenient when it comes to app states. You can get your Nifty from the initialize method in your AppState by calling

[java]

app.getStateManager().getState(NiftyAppState.class);

[/java]



It’s very simple and it looks like this.

[java]

public class NiftyAppState extends AbstractAppState {



protected NiftyJmeDisplay niftyDisplay;

protected Nifty nifty;



@Override

public void initialize(AppStateManager stateManager, Application app) {

super.initialize(stateManager, app);

niftyDisplay = new NiftyJmeDisplay(

app.getAssetManager(),

app.getInputManager(),

app.getAudioRenderer(),

app.getViewPort());

nifty = niftyDisplay.getNifty();

}



public NiftyJmeDisplay getDisplay() {

return niftyDisplay;

}



public Nifty getNifty() {

return nifty;

}

}

[/java]



Don’t fell like I am creating a debate I’m just giving something out that is useful and simple.

3 Likes

Yeah there could really be something like that… Thanks, we might add it :slight_smile:

Edit: It could also contain some of the most used nifty workarounds in terms of input and gui node ordering etc.

Kool @normen the one I have actually has a goToScreen(String name) method.

I would assume that if such AppState was added to core, it would require a proper implementation of the enable/disable/cleanup functionality.