Can any one help me :
i want to start my game from nifty gui by click start button,but before load game models i want to pass some parameters
i try hard to do this but after nifty close it give me black screen ,no one models can be loaded
i try in this code :
[java]package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.niftygui.NiftyJmeDisplay;
import com.jme3.renderer.RenderManager;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
/**
- test
-
@author normenhansen
/
public class Test extends SimpleApplication implements ScreenController{
Nifty nifty;
Screen screen;
boolean start = false;
NiftyJmeDisplay niftyDisplay;
Geometry player;
Test app;
public static void main(String[] args) {
Test app = new Test();
app.start();
}
@Override
public void simpleInitApp() {
// disable the fly cam
flyCam.setEnabled(false);
niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager,
audioRenderer, guiViewPort);
nifty = niftyDisplay.getNifty();
nifty.fromXml("Interface/GuiX.xml", "start");
// attach the nifty display to the gui view port as a processor
guiViewPort.addProcessor(niftyDisplay);
}
public void LoadMainGame(){
System.out.println("ssssssssssssssssssssssss");
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
player = new Geometry("blue cube", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
player.setMaterial(mat);
rootNode.attachChild(player);
start=true;
}
public void start2() {
nifty.exit();
System.out.println("Welcome");
LoadMainGame();
inputManager.setCursorVisible(false);
flyCam.setEnabled(true);
}
@Override
public void simpleUpdate(float tpf) {
if(start)
{
System.out.println("No");
player.rotate(0, 2tpf, 0);
}
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}
public void bind(Nifty nifty, Screen screen) {
this.nifty = nifty;
this.screen = screen;
}
public void onStartScreen() {
}
public void onEndScreen() {
}
}[/java]
any one can help me to find the true sequence or missing calling method