NiftyGUI question

New to NiftyGUI and I’m finding a lack of thoroughness in explaining how to incorporate it successfully with JME2. I have it displaying my xml file (a hello world example for now) upon enterting a SimpleGame with nothing but a box to look at. however I have no mouse visible during the niftygui even though I’ve explicitly set it visible in the panel and the layer and am using the OnClick functionality which I thought automatically made it visible. The only interaction I can manage is to Alt+F4 and then it destroys the GUI and commences with the game. any ideas?



code

[java] protected void simpleInitGame() {

// TODO Auto-generated method stub

Box box = new Box(“box”, new Vector3f(0, 0, -10), 1, 1, 1);

rootNode.attachChild(box);



Nifty gui = new Nifty(

new JmeRenderDevice(),

new JmeSoundDevice(),

new JmeInputSystem(),

new TimeProvider());



gui.fromXml(“C:/Java/Eclipses/testTransparency/niftytests/hellotest.xml”, “start”);

LwjglInitHelper.renderLoop(gui, null);

}[/java]

[java]






























[/java]

I dont think the Nifty GUI creates the mouse cursor for you… Look at the other mouse examples to see how thats done.

Creates the mouse cursor? I’m just looking to have the default, something visual. I seem to have literally no inputs during the niftygui except to Alt+f4, which drops the niftygui screen and then i can see the simple box i placed there.

Yeah, just use the default visual mouse cursor, look at the examples.

Well not sure if that way I was trying even works but I found the example in the nifty-jme-renderer-1.0-20100929.153836-2.jar and it had a completely different and streamlined implementation for this…



[java]NiftyNode guiNode = new NiftyNode(“GUI:NIFTYNODE”,

“C:/Java/Eclipses/testTransparency/niftytests/hellotest.xml”,

“start”);

rootNode.attachChild(guiNode);[/java]



it’s invisible at the moment but i can see that it sets up and i can see the functions being called when I move my cursor over the correct areas. I’ll get it showing soon I’m sure.

I’VE DISCOVERED SOMETHING! I think…



In my tower defense game I’m making; I am attaching all of the game to a rootGameNode and then attaching that to rootNode. The niftyNode (see above) I am attaching separately.

[java] rootNode

|

|


|
rootGameNode guiNode
| |
everything else NiftyNode[/java]

The way I code, at the end of my simpleInitGame method I do most of my attaching of the bigger parent Nodes;
[java] rootGameNode.attachChild(sb);
rootGameNode.attachChild(rootTerrainNode);
rootGameNode.attachChild(rootCrittersNode);
rootGameNode.attachChild(rootTowersNode);

rootNode.attachChild(rootGameNode);
rootNode.attachChild(guiNode);
rootNode.updateRenderState();[/java]

And I found through testing that is I attach the guiNode just BEFORE the rootGameNode then it still registers but is invisible. I tracked this down to my skybox which I setup before going all these attachings. The lights played no part, the cullstate of the skybox played no part. This chunk of code, from a tutorial here;
[java] sb = new Skybox("skybox", 200, 200, 200);

try {
ResourceLocatorTool.addResourceLocator(
ResourceLocatorTool.TYPE_TEXTURE,
new SimpleResourceLocator(getClass().getResource(
"/assets/textures/")));
} catch (Exception e) {
System.out.println("Unable to access texture directory.");
e.printStackTrace();
}

sb.setTexture(Skybox.Face.North, TextureManager.loadTexture(
"north.jpg", Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.West, TextureManager.loadTexture("west.jpg",
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.South, TextureManager.loadTexture(
"south.jpg", Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.East, TextureManager.loadTexture("east.jpg",
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.Up, TextureManager.loadTexture("top.jpg",
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.Down, TextureManager.loadTexture(
"bottom.jpg", Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.preloadTextures();[/java]

When paired with attaching the rootGameNode (sb's parent) AFTER having attached the guiNode would make the guiNode invisible. Hope this helps somebody else. But I'm still wondering why exactly. I'm not to knowledgable about rendering.