I’ve read several tutorials, but it’s not clear to me. I’ve made a menubar in the Nifty Editor. There are several images in the menubar. I don’t really know how to use the xml files.
This is the code I use to create the menubar (its a HUD actually)
[java]private void initHud() {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
assetManager, inputManager, audioRenderer, guiViewPort);
Nifty nifty = niftyDisplay.getNifty();
nifty.registerScreenController(new HudScreenController(this));
guiViewPort.addProcessor(niftyDisplay);
StartScreenState startScreenState = new StartScreenState(this);
stateManager.attach(startScreenState);
nifty.fromXml("Interface/main.xml", "main", startScreenState);
}
[/java]
And the screencontroller:
package game;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;
public class StartScreenState extends AbstractAppState implements ScreenController {
public StartScreenState(SimpleApplication app) {
}
public void bind(Nifty nifty, Screen screen) {
}
public void onStartScreen() {
}
public void onEndScreen() {
}
}
[/java]
The following things are not cleear for me:
- I extend AbstractAppState in my StartScreenController, which means the HUD “is” an AppState.
- I don’t know how to set the screencontroller.