Hi, I just started to work with nifty and am new to this. I wanted to make a GUI so I tried doing some basic tests but all I get is a black screen. I know I am doing something wrong. Any advice will be helpful.
Here is what I was trying do to:
TestNifty.java
[java]
package mainGame;
import com.jme3.app.SimpleApplication;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;
public class TestNifty extends SimpleApplication{
Nifty nifty;
public static void main(String [] args)
{
TestNifty app = new TestNifty();
app.start();
}
@Override
public void simpleInitApp() {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
assetManager,
inputManager,
audioRenderer,
guiViewPort
);
nifty = niftyDisplay.getNifty();
nifty.fromXml("Ingerface/Niftyy.xml", "start");
guiViewPort.addProcessor(niftyDisplay);
flyCam.setDragToRotate(true);
}
}
[/java]
Niftyy.xml
[xml]
<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty.xsd http://nifty-gui.sourceforge.net/nifty.xsd">
<screen id="start" controller="mainGame.TestNifty">
<layer id="layer" backgroundColor="#003f" childLayout="center">
<panel id="panel" height="25%" width="35%" align="center" valign="center" backgroundColor="#f60f" childLayout="center" visibleToMouse="true">
<interact onClick="quit()"/>
<effect>
<onStartScreen name="move" mode="in" direction="top" length="300" startDelay="0" inherit="true"/>
<onEndScreen name="move" mode="out" direction="bottom" length="300" startDelay="0" inherit="true"/>
<onHover name="pulsate" scaleFactor="0.008" startColor="#f600" endColor="#ffff" post="true"/>
</effect>
<text id="text" font="aurulent-sans-17.fnt" color="#000f" text="Hello World!" align="center" valign="center" />
</panel>
</layer>
</screen>
</nifty>
[/xml]
This is just a basic test I tried to do so that I could see what was happening and learn from there but I dont get anything just a blank screen.
I solved the problem. it was just a mistype in line 21
line 21:
[java]nifty.fromXml("Ingerface/Niftyy.xml", "start");[/java]
It should have been Interface. Sorry for this.
K Out!