My game implements a head-up display using Nifty. When I upgraded from RC2 to 3.0Stable, the HUD’s appearance changed for the worse, with all the labels in the scrollPanel becoming invisible illegible. I’ve written a small test app which demonstrates the issue:
[java]
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;
/**
-
A simple JME3 app to demonstrate the Nifty scrollPanel control.
*/
public class Main extends SimpleApplication {public static void main(String[] args) {
Main app = new Main();
app.setShowSettings(false);
app.start();
}@Override
public void simpleInitApp() {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager, audioRenderer, guiViewPort);
Nifty nifty = niftyDisplay.getNifty();
String interfaceAssetPath = “Interface/hud.xml”;
nifty.addXml(interfaceAssetPath);
viewPort.addProcessor(niftyDisplay);
nifty.gotoScreen(“hud”);
}
}
[/java]
Here’s the hud.xml file:
[java]
<?xml version=“1.0” encoding=“UTF-8”?>
<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>
<useStyles filename=“nifty-default-styles.xml”/>
<useControls filename=“nifty-default-controls.xml”/>
<screen id="hud">
<layer childLayout="horizontal">
<panel/>
<panel childLayout="vertical"
width="190">
<control name="scrollPanel"
horizontal="false">
<panel childLayout="vertical"
backgroundColor="#f0ff"
padding="10">
<control name="button"
label="a button label"/>
<control name="label"
color="#0f0f"
text="some green text"/>
</panel>
</control>
</panel>
</layer>
</screen>
</nifty>
[/java]