Nifty GUI Screen Invisible

Hi guys, so I’ve been working with JME3 all summer, but am still a relative noob. I am currently working on implementing a nifty GUI for my game. I had it up and running for a couple days and it was working how I would like it to until I merged a file with a coworker for the project. As soon as we merged the documents, the game would work, but the GUIs would not be displayed. I have gone over and over the code, taken it apart to put it back together, and just flat out rewritten it to make sure I’m not missing something small, but have had no luck.

Here’s the code that refers to the GUI that is in main.java
[java]
// GUI stuff
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
//create a nifty object
Nifty nifty = niftyDisplay.getNifty();
guiViewPort.addProcessor(niftyDisplay);

	nifty.fromXml("Interface/MainMenuLayout.xml", "start", new MainMenuController());  		
	nifty.addXml("Interface/SettingsScreen.xml");
	nifty.addXml("Interface/CalibrationScreen.xml");
	nifty.addXml("Interface/TrialScreen.xml");
	nifty.addXml("Interface/FeedbackScreen.xml");
	nifty.gotoScreen("start");

[/java]

Here’s the XML file I’m working with

[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 http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>
<useStyles filename=“nifty-default-styles.xml” />
<useControls filename=“nifty-default-controls.xml” />

&lt;panel id="panel_background" width="50%" height="80%"
	childLayout="vertical"&gt;

	&lt;!-- Start Screen --&gt;
	&lt;screen id="start" controller="smpp.experiment.game.MainMenuController"&gt;
		&lt;!-- This should add the background image --&gt;
		&lt;layer id="background" childLayout="center" width="100%"
			height="100%"&gt;
			&lt;image filename="Interface/FlightControlBackground.png"&gt;&lt;/image&gt;
		&lt;/layer&gt;

		&lt;layer id="foreground" childLayout="vertical"&gt;
			&lt;!-- Empty Spacer Panel to accomodate the background's header --&gt;
			&lt;panel id="panel_top" height="20%" width="100%" align="center"
				childLayout="center"&gt;
			&lt;/panel&gt;

			&lt;!-- Settings panel --&gt;
			&lt;panel id="panel_settings" height="15%" width="100%" align="center"
				childLayout="center"&gt;
				&lt;control name="button" font="aurulent-sans-16.fnt" label="Settings"
					id="SettingsButton" align="center" valign="center" visibleToMouse="true"&gt;
					&lt;interact onClick="gotoScreen(settings)" /&gt;
				&lt;/control&gt;
			&lt;/panel&gt;

			&lt;!-- Recalibrate Button --&gt;
			&lt;panel id="panel_recalibrate" height="15%" width="100%" align="center"
				childLayout="center"&gt;
				&lt;control name="button" label="Recalibrate" id="RecalibrationButton"
					align="center" valign="center" visibleToMouse="true"&gt;
					&lt;interact onClick="gotoScreen(calibrate)" /&gt;
				&lt;/control&gt;
			&lt;/panel&gt;
			&lt;!-- Play Button --&gt;
			&lt;panel id="panel_play" height="15%" width="100%" align="center"
				childLayout="center"&gt;
				&lt;control name="button" label="Play!" id="PlayButton" align="center"
					valign="center" visibleToMouse="true"&gt;
					&lt;interact onClick="gotoScreen(play)" /&gt;
				&lt;/control&gt;
			&lt;/panel&gt;
		&lt;/layer&gt;
	&lt;/screen&gt;
&lt;/panel&gt;

</nifty>
[/java]

Any suggestions as to where I could have gone wrong would be extremely helpful.

Thanks!

Meredith

My guess would be that it can’t parse that file correctly because your “panel_background” is outside the screen.

1 Like

Good catch! That’s definitely an error, but unfortunately still no dice, the screen is not displayed when I put the panel_background inside the screen.