I want to start my game from nifty GUI

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, 2
    tpf, 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

GUIX.xml

[xml]<?xml version="1.0" encoding="UTF-8"?>

<nifty>



<!-- +++++++++++++++++++++++++++++++++++++++ -->

<!-- load default styles and controls -->

<!-- +++++++++++++++++++++++++++++++++++++++ -->

<useStyles filename="nifty-default-styles.xml" />

<useControls filename="nifty-default-controls.xml" />



<style id="console-red" base="button-font">

<attributes font="fonts/menu.fnt" color="#f00f"/>

</style>

<style id="console-white" base="button-font">

<attributes font="fonts/menu.fnt" color="#ffff"/>

</style>

<style id="console-font">

<attributes font="fonts/verdana-48-regular.fnt" color="#00ff"/>

</style>



<!-- +++++++++++++++++++++++++++++++++++++++ -->

<!-- start screen -->

<!-- +++++++++++++++++++++++++++++++++++++++ -->

<screen id="start" controller="mygame.Test">

<layer id="chooseflayer" backgroundImage="Textures/new.png" childLayout="center">

<panel id="choosefpanel" style="nifty-panel" height="110px" width="200px" align="center" valign="center" childLayout="vertical">

<effect>

<onStartScreen name="move" timeType="exp" factor="3.5" direction="top" mode="in" length="500" inherit="true"/>

<onEndScreen name="move" timeType="exp" factor="3.5" direction="top" mode="out" length="500" inherit="true"/>

</effect>

<panel childLayout="center" width="100%">

<control id="addfacbutton" name="button" label="Start" align="center" height="80px">

<interact onClick="start2()" />

</control>

</panel>

</panel>

</layer>

</screen>

</nifty>

[/xml]

change

[java]nifty.fromXml("Interface/GuiX.xml", "start");[/java]

to

[java]nifty.fromXml("Interface/GuiX.xml", "start", this);[/java]

Thanks for your post …

please add me on your mail >>>>>>or facebook to communicate with them

thank you very match

Mu7amed_abdelfata7@yahoo.com