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” />
<panel id="panel_background" width="50%" height="80%"
childLayout="vertical">
<!-- Start Screen -->
<screen id="start" controller="smpp.experiment.game.MainMenuController">
<!-- This should add the background image -->
<layer id="background" childLayout="center" width="100%"
height="100%">
<image filename="Interface/FlightControlBackground.png"></image>
</layer>
<layer id="foreground" childLayout="vertical">
<!-- Empty Spacer Panel to accomodate the background's header -->
<panel id="panel_top" height="20%" width="100%" align="center"
childLayout="center">
</panel>
<!-- Settings panel -->
<panel id="panel_settings" height="15%" width="100%" align="center"
childLayout="center">
<control name="button" font="aurulent-sans-16.fnt" label="Settings"
id="SettingsButton" align="center" valign="center" visibleToMouse="true">
<interact onClick="gotoScreen(settings)" />
</control>
</panel>
<!-- Recalibrate Button -->
<panel id="panel_recalibrate" height="15%" width="100%" align="center"
childLayout="center">
<control name="button" label="Recalibrate" id="RecalibrationButton"
align="center" valign="center" visibleToMouse="true">
<interact onClick="gotoScreen(calibrate)" />
</control>
</panel>
<!-- Play Button -->
<panel id="panel_play" height="15%" width="100%" align="center"
childLayout="center">
<control name="button" label="Play!" id="PlayButton" align="center"
valign="center" visibleToMouse="true">
<interact onClick="gotoScreen(play)" />
</control>
</panel>
</layer>
</screen>
</panel>
</nifty>
[/java]
Any suggestions as to where I could have gone wrong would be extremely helpful.
Thanks!
Meredith