NiftyGui Layout Problem (xml)

So, here’s my problem: I tried out Nifty GUI. It doesn’t like me.

I tried to copy the tutorial code. That’s my xml code:



gui.xml

[java]

<?xml version=“1.0” encoding=“UTF-8”?>

<nifty xmlns=“http&#58;//nifty-gui.sourceforge.net/nifty-1.3.xsd” xmlns:xsi=“http&#58;//www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http&#58;//nifty-gui.sourceforge.net/nifty-1.3.xsd http&#58;//nifty-gui.sourceforge.net/nifty-1.3.xsd”>

<!-- +++++++++++++++++++++++++++++++++++++++ →

<!-- start screen →

<!-- +++++++++++++++++++++++++++++++++++++++ →

<screen id=“start” controller=“mygame.Main”>

<layer id=“layer” backgroundColor="#003f" childLayout=“center”>

<panel id=“panel_top” height=“25%” width=“75%” align=“center” childLayout=“center”

backgroundColor="#f008">

</panel>

<panel id=“panel_mid” height=“50%” width=“75%” align=“center” childLayout=“center”

backgroundColor="#0f08">

</panel>

<panel id=“panel_bottom” height=“25%” width=“75%” align=“center” childLayout=“horizontal”

backgroundColor="#00f8">

<panel id=“panel_bottom_left” height=“50%” width=“50%” valign=“center” childLayout=“center”

backgroundColor="#44f8">

</panel>

<panel id=“panel_bottom_right” height=“50%” width=“50%” valign=“center” childLayout=“center”

backgroundColor="#88f8">

</panel>

</panel>

</layer>

</screen>

</nifty>

[/java]



main.java

[java]@Override

public void simpleInitApp() {

NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(

assetManager, inputManager, audioRenderer, guiViewPort);

Nifty nifty = niftyDisplay.getNifty();

nifty.fromXml(“Interface/gui.xml”, “start”);

guiViewPort.addProcessor(niftyDisplay);

flyCam.setDragToRotate(true);

}

[/java]



And this is what happens:

http://i.imagebanana.com/img/sgkdl74s/Unbenannt.png



When it should look more like the left one here:

https://wiki.jmonkeyengine.org/legacy/lib/exe/fetch.php/jme3:advanced:nifty-gui-panels.png?cache=



Any help for poor old me?

I know you said ignore the xml tags, but it seems that you followed your main panel open tag with a close tag. Perhaps if you let your first panel parent the others, the outcome will be as you expected. :wink:

I said ignore the anchor-tags in the xml code^^ sorry, but the page added some anchor-tags in the code, but i managed to delete them now.

And no, parenting doesn’t help

The red ‘panel_top’ should not be visible; the green ‘mid_panel’ should overpaint it.



I guess this could be a version problem.

Nifty 1.3.1 only supports one child if the attribute childLayout is set to center.

This is fixed in nifty 1.3.2. So, do you get any warnings ?

Hmm, that’s strange, seems like I have a very old version of nifty gui, but I don’t get any update notifications…

Well, I’ll manage with horizontal and vertical child layout, thanks for your help!

@Din said:
Hmm, that's strange, seems like I have a very old version of nifty gui, but I don't get any update notifications...
Well, I'll manage with horizontal and vertical child layout, thanks for your help!

U still run beta? RC2 is out.

Well, that’s what happens when you aren’t developing for somewhat 3 or 5 months…

Thanks norm!