Hi all,
I was working with jME3-alpha3 and at last I decided to update to beta version which seems to be really improved and more “production ready” but I’m facing some problems related to nifty just after the update…
The first one and probably the most extrange of them is that my menu items (labels inside a scrollpanel) renders now completely black. My menu is based on the old nifty 1.2 sample xml file (intro.xml) but updated to 1.3 (changed labels to text and added font=“file.fnt” to the style).
[xml]
<style id=“menu-item” base=“menu-font”>
<attributes align=“left” textHAlign=“left” color="#cccf" width=“100%” font=“menu.fnt”
focusable=“true”
controller=“de.lessvoid.nifty.controls.MenuItemControl”
inputMapping=“de.lessvoid.nifty.input.mapping.MenuInputMapping”
/>
<effect>
<onHover name=“focus” />
<onFocus name=“hint” targetElement=“hintElement” hintText="$hintText" />
<onFocus name=“colorBar” width=“120%” height=“120%” color="#fff5" />
<onFocus name=“textColor” color="#ffff" />
<onFocus name=“textSize” startSize=“1.0” endSize=“1.25” length=“150” />
<onFocus name=“playSound” sound=“select” />
<onGetFocus name=“updateScrollpanelPositionToDisplayElement” target=“menuScrollPanel” oneShot=“true” />
<onGetFocus name=“show” targetElement="$targetElement" oneShot=“true” />
<onLostFocus name=“textSize” startSize=“1.25” endSize=“1.0” length=“150” />
<onLostFocus name=“hide” targetElement="$targetElement" oneShot=“true” />
</effect>
</style>
<control id=“menuScrollPanel” name=“scrollPanel” style=“special-scrollpanel” horizontal=“false” stepSizeY=“20” height=“100%”>
<panel id=“huhu-1” childLayout=“center” width=“100%” height=“350px” padding=“0px,0px,0px,120px”>
<panel id=“huhu-2” childLayout=“vertical” width=“100%”>
<text id=“garage” text=“Garage” style=“menu-item” hintText=“Garage” targetElement=“thumbGarage”>
<interact onClick=“garage()” onClickAlternateKey=“fade” />
</text>
<text id=“race” text=“Race” style=“menu-item” hintText=“Race” targetElement=“thumbRace”>
<interact onClick=“race()” onClickAlternateKey=“fade” />
</text>
<text id=“championship” text=“Championship” style=“menu-item” hintText=“Championship” targetElement=“thumbChampionship”>
<interact onClick=“championship()”/>
</text>
<text id=“editor” text=“Race Editor” hintText=“Race Editor” style=“menu-item” targetElement=“thumbEditor”>
<interact onClick=“editor()”/>
</text>
<text id=“ranking” text=“Ranking” hintText=“Ranking” style=“menu-item” targetElement=“thumbRanking”>
<interact onClick=“ranking()”/>
</text>
<text id=“options” text=“Options” hintText=“Options” style=“menu-item” targetElement=“thumbOptions”>
<interact onClick=“options()”/>
</text>
<text id=“credits” text=“Credits” style=“menu-item” hintText=“Credits” targetElement=“thumbCredits”>
<interact onClick=“credits()”/>
</text>
</panel>
</panel>
</control>
[/xml]
I’m using popups in my application but now, they are just not found :S. In the application log I get the warning “missing popup [popup_name] o_O”.
I also use appStates, one for the menu and other for the game itself. When I go from the menuState to the gameState input events are still processed by the nifty of the menuState. Obviously, I detach the menuState from the stateManager, remove the views and so on. Is there anything new/extra needed to be done now to completely disable an appState (and its input).
Just for you to know, I’ve validated all my nifty xml files with nifty.validate(“file.xml”) and everything is fine. Had some ordering problems which I already solved before posting.
Thanks for your help.
As for the popups, I believe they were once similar to layers and now they are defined outside of screens.
old:
[xml]
<nifty>
<screen>
<popup>
</popup>
</screen>
</nifty>
[/xml]
new:
[xml]
<nifty>
<screen>
</screen>
<popup>
</popup>
</nifty>
[/xml]
This page might help, but I think it’s partly outdated.
between nifty 1,2 and nifty 1.3, labels changed a lot. They used to have their own tag, now they are a control
But for your menu, wouldn’t be a better choice?
Hello,
@survivor, my nifty xml files defines the popups out of the screen tags which was already correct for nifty 1.2. The link you attached didn’t help also…
@ractoc, I read about the changes between 1.2 and 1.3, including the label change from being a tag by itself to be a control. I changed my xml files to use the text tag and the control label to test but none of them worked as expected (inside a scrollpanel). Finally I use text because I find it simplier to read.
Thanks for your comment.
Hello again,
I have made some tests about the scrollpanel content rendering completely black. I have made a new simple nifty layout containing two scrollpanels (both are the same just changing the id’s) and one of them renders correctly but the other renders black. I attach an screenshot and the xml code
[xml]
<style id=“menu-item2” base=“menu-font”>
<attributes align=“left” textHAlign=“left” color="#cccf" width=“100%”
focusable=“true”
controller=“de.lessvoid.nifty.controls.MenuItemControl”
inputMapping=“de.lessvoid.nifty.input.mapping.MenuInputMapping”
font=“menu.fnt”
/>
</style>
<screen id=“menu” controller=“networkwebgames.railracer.states.AllMenusState”>
<layer childLayout=“vertical” backgroundImage=“background.png”>
<effect>
<onStartScreen name=“fade” start="#0" end="#f" length=“500” alternateEnable=“fade” />
</effect>
<panel id=“panel-logo” width=“100%” height=“20%” childLayout=“center”>
<image id=“image-logo” filename=“logo.png” align=“center” valign=“center” />
</panel>
<panel id=“container” childLayout=“vertical”>
<panel id=“panel1a” width=“100%” height=“40%” childLayout=“center” padding=“10px,0px,10px,0px”>
<control id=“scroll1” name=“scrollPanel” style=“special-scrollpanel” horizontal=“false” stepSizeY=“20” height=“100%”>
<panel id=“panel1b” width=“100%” height=“350px” childLayout=“vertical”>
<text id=“garage1” text=“Garage” style=“menu-item2” >
<interact onClick=“garage()” onClickAlternateKey=“fade” />
</text>
<text id=“race1” text=“Race” style=“menu-item2” >
<interact onClick=“race()” onClickAlternateKey=“fade” />
</text>
</panel>
</control>
</panel>
<panel id=“panel2a” width=“100%” height=“40%” childLayout=“center” padding=“10px,0px,10px,0px”>
<control id=“scroll2” name=“scrollPanel” style=“special-scrollpanel” horizontal=“false” stepSizeY=“20” height=“100%”>
<panel id=“panel2b” width=“100%” height=“350px” childLayout=“vertical”>
<text id=“garage2” text=“Garage” style=“menu-item2” >
<interact onClick=“garage()” onClickAlternateKey=“fade” />
</text>
<text id=“race2” text=“Race” style=“menu-item2” >
<interact onClick=“race()” onClickAlternateKey=“fade” />
</text>
</panel>
</control>
</panel>
</panel>
</layer>
</screen>
[/xml]
Could this be a bug in nifty?
Maybe are you messing up in some important thing? I’ve just modified your code a bit and it works pretty nice!
EDIT: HMmmm. I just read all the topic, and it’s not about the scroll panels itself, its about their children ok? Hmm. The children weren’t rendered in my test…
here’s the code
[xml]
<?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” />
<screen id=“menu” controller=“networkwebgames.railracer.states.AllMenusState”>
<layer childLayout=“vertical” backgroundImage=“Interface/Backgrounds/Background.png”>
<effect>
<onStartScreen name=“fade” start="#0" end="#f" length=“500” alternateEnable=“fade” />
</effect>
<panel id=“panel-logo” width=“100%” height=“20%” childLayout=“center”>
<image id=“image-logo” filename=“Interface/Backgrounds/Background.png” align=“center” valign=“center” />
</panel>
<panel id=“container” childLayout=“vertical”>
<panel id=“panel1a” width=“100%” height=“40%” childLayout=“vertical” padding=“10px,0px,10px,0px”>
<control id=“scroll1” name=“scrollPanel” style=“special-scrollpanel” horizontal=“false” stepSizeY=“20” height=“100%” backgroundColor="#ff000055">
<panel id=“panel1b” width=“100%” height=“350px” childLayout=“vertical”>
<text id=“garage1” text=“Garage” style=“menu-item2” >
<interact onClick=“garage()” onClickAlternateKey=“fade” />
</text>
<text id=“race1” text=“Race” style=“menu-item2” >
<interact onClick=“race()” onClickAlternateKey=“fade” />
</text>
</panel>
</control>
</panel>
<panel id=“panel2a” width=“100%” height=“40%” childLayout=“vertical” padding=“10px,0px,10px,0px”>
<control id=“scroll2” name=“scrollPanel” style=“special-scrollpanel” horizontal=“false” stepSizeY=“20” height=“100%” backgroundColor="#00ff0055">
<panel id=“panel2b” width=“100%” height=“350px” childLayout=“vertical”>
<text id=“garage2” text=“Garage” style=“menu-item2” >
<interact onClick=“garage()” onClickAlternateKey=“fade” />
</text>
<text id=“race2” text=“Race” style=“menu-item2” >
<interact onClick=“race()” onClickAlternateKey=“fade” />
</text>
</panel>
</control>
</panel>
</panel>
</layer>
</screen>
</nifty>
[/xml]
@glaucomardano I noticed that your screenshot is made on jMP. Inside jMP my xml renders perfectly (same as yours) but when used in the game it renders like in my previous screenshot. Probably I’m doing something wrong, but previous jME version I was using (alpha3) worked correctly and I have not changed my nifty initialization java code, which reads as follows
[java]
niftyDisplay = new NiftyJmeDisplay(getAssetManager(), getInputManager(), getAudioRenderer(),guiViewPort);
niftyDisplay.getNifty().fromXml(“Interface/allmenus.xml”, “menu”,this);
guiViewPort.addProcessor(niftyDisplay);
[/java]
Any other ideas?
Make sure you use the libraries set coming with the SDK for the projects instead of referencing jar files directly, I can’t imagine how else there should be differences in the SDK and your game rendering nifty.
@normen I’ve checked the libraries on my project: jme3 and jme3-libraries (the defaults). I’m using appStates, just in case there is something to do with this…
I guess your jmp is not up to date!? Because now there are several libralies, and the jME3-niftygui libraly should be in your project’s classpath.
nifty should be in the “global” jme3-libraries… so everything should work… idk whats up here.
I’ve just updated my jMP installation (stable, no nightly) with the same result. Any other ideas?
Thanks
Hi again,
Finally I got my scrollpanel content shown. I was creating a new “main” view to show the GUI instead of a “post” view like in the sample code because I need to render some 3D content on top of the GUI. I tested it using “post” and “pre” and both render correctly… I don’t understand why the content is not rendered using a “main” view…
Old code:
[java]
guiViewPort = getRenderManager().createMainView(“Gui”, guiCam);
guiViewPort.setClearFlags(true,true,true);
guiViewPort.attachScene(guiNode);
[/java]
New code:
[java]
guiViewPort = getRenderManager().createPreView(“Gui”, guiCam);
guiViewPort.setClearFlags(true,true,true);
guiViewPort.attachScene(guiNode);
[/java]
I’m still trying to solve the popup and appStates input problems
Thanks
Popup problem solved!!! I found the solution in another thread http://hub.jmonkeyengine.org/groups/gui/forum/topic/nifty-draggable-panel-dissappears-after-clicking/.
Just changed my code from:
[java]
nifty.createPopup(popupID);
[/java]
To:
[java]
nifty.createPopupWithId(popupID, popupID);
[/java]
What does this code do? Is it really needed?
[java]
guiViewPort = getRenderManager().createPreView("Gui", guiCam);
guiViewPort.setClearFlags(true,true,true);
guiViewPort.attachScene(guiNode);
[/java]
@glaucomardano This code is used to create a new view in the appState which I need because I am rendering multiple views the following way (from bottom to top/background to front):
- base GUI (menus and so on) → rendered in pre view (previously this was in main view)
- car or track renders for the user to select → rendered in main view
- car specs in a 3D graphical way → rendered in post view
- GUI for popups → rendered in post view
All those views except from base GUI are optional and only are active when the menu needs it (cars are not rendered if the user is not selecting a car :P).
Probably there is a better way to implement this in jme, but I found this way clear enough.
Hi again,
I’ve coded a simple test case for the problem of a dettached appState leaving its nifty input active. The test case is composed of 3 java classes (main, and two states) and 2 nifty xml files. If you click on the first state centered panel, this state is deactivated and the second state gets activated and the other way round. But when state1 is deactivated and state2 is activated, clicking the panel results in the callback of state1 being processed :S I copy my code here
main.java:
[java]
package mygame;
import com.jme3.app.Application;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeContext;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main extends Application implements ScreenController
{
NiftyState1 nifty1;
NiftyState2 nifty2;
public static void main(String[] args)
{
Main app = new Main();
app.start();
}
@Override
public void start(JmeContext.Type contextType)
{
AppSettings settings = new AppSettings(true);
settings.setResolution(640, 480);
settings.setRenderer(AppSettings.LWJGL_OPENGL2);
settings.setAudioRenderer(AppSettings.LWJGL_OPENAL);
settings.setTitle("");
settings.setFrameRate(30);
setSettings(settings);
super.start(contextType);
this.setPauseOnLostFocus(false);
}
@Override
public void initialize()
{
super.initialize();
//Disable clear in the default viewport in the app
this.viewPort.setClearFlags(false,false,false);
this.guiViewPort.setClearFlags(false, false, false);
nifty1=new NiftyState1(this,this.settings);
nifty2=new NiftyState2(this,this.settings);
//Only activate nifty1
nifty1.activateState();
}
@Override
public void update(){
super.update();
// do some animation
float tpf = timer.getTimePerFrame();
stateManager.update(tpf);
stateManager.render(renderManager);
// render the viewports
renderManager.render(tpf,context.isRenderable());
}
@Override
public void destroy(){
super.destroy();
}
public void bind(Nifty nifty, Screen screen)
{
}
public void onStartScreen()
{
}
public void onEndScreen()
{
}
/**
- Callback from nifty1 screen
*
- Deactivates nifty1 and activates nifty2
*/
public void nifty1()
{
Logger.getLogger("").log(Level.WARNING, "Nifty1 callback - changing to nifty2 screen");
nifty1.deactivateState();
nifty2.activateState();
}
/**
- Callback from nifty2 screen
*
- Deactivates nifty2 and activates nifty1
*/
public void nifty2()
{
Logger.getLogger("").log(Level.WARNING, "Nifty2 callback - changing to nifty1 screen");
nifty2.deactivateState();
nifty1.activateState();
}
}
[/java]
NiftyState1.java:
[java]
package mygame;
import com.jme3.app.Application;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioRenderer;
import com.jme3.audio.Listener;
import com.jme3.input.InputManager;
import com.jme3.input.JoyInput;
import com.jme3.input.KeyInput;
import com.jme3.input.MouseInput;
import com.jme3.math.Vector3f;
import com.jme3.niftygui.NiftyJmeDisplay;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial.CullHint;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeContext;
public class NiftyState1 extends AbstractAppState
{
protected Main main;
protected AssetManager assetManager;
protected AudioRenderer audioRenderer;
protected RenderManager renderManager;
protected AppStateManager stateManager;
protected Listener listener;
protected JmeContext context;
protected MouseInput mouseInput;
protected KeyInput keyInput;
protected JoyInput joyInput;
protected InputManager inputManager;
protected ViewPort viewPort;
protected ViewPort guiViewPort;
protected Node rootNode = new Node("Root Node");
protected Node guiNode = new Node("Gui Node");
protected Camera cam;
protected Camera guiCam;
private NiftyJmeDisplay niftyDisplay;
public NiftyState1(Main m, AppSettings settings)
{
main=m;
Application app=(Application)main;
assetManager=app.getAssetManager();
audioRenderer=app.getAudioRenderer();
renderManager=app.getRenderManager();
stateManager=app.getStateManager();
listener=app.getListener();
context=app.getContext();
mouseInput=context.getMouseInput();
keyInput=context.getKeyInput();
joyInput=context.getJoyInput();
inputManager=app.getInputManager();
cam = new Camera(context.getSettings().getWidth(), context.getSettings().getHeight());
cam.setFrustumPerspective(45f, (float)cam.getWidth() / cam.getHeight(), 1f, 1000f);
cam.setLocation(new Vector3f(0f, 0f, 10f));
cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
guiCam = new Camera(context.getSettings().getWidth(), context.getSettings().getHeight());
guiNode.setQueueBucket(Bucket.Gui);
guiNode.setCullHint(CullHint.Never);
}
public void activateState()
{
stateManager.attach(this);
viewPort = renderManager.createMainView("Main nifty1", cam);
viewPort.setClearFlags(true,true,true);
viewPort.attachScene(rootNode);
guiViewPort = renderManager.createPostView("Gui nifty1", guiCam);
guiViewPort.setClearFlags(false,true,true);
guiViewPort.attachScene(guiNode);
niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
niftyDisplay.getNifty().fromXml("Interface/nifty1.xml", "start", main);
guiViewPort.addProcessor(niftyDisplay);
}
public void deactivateState()
{
stateManager.detach(this);
if(viewPort!=null)
{
viewPort.setClearFlags(false,false,false);
renderManager.removeMainView(viewPort);
}
if(guiViewPort!=null)
{
guiViewPort.removeProcessor(niftyDisplay);
guiViewPort.setClearFlags(false,false,false);
renderManager.removePostView(guiViewPort);
}
}
@Override
public void update(float tpf) {
super.update(tpf);
rootNode.updateLogicalState(tpf);
rootNode.updateGeometricState();
guiNode.updateLogicalState(tpf);
guiNode.updateGeometricState();
}
}
[/java]
NiftyState2
[java]
package mygame;
import com.jme3.app.Application;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioRenderer;
import com.jme3.audio.Listener;
import com.jme3.input.InputManager;
import com.jme3.input.JoyInput;
import com.jme3.input.KeyInput;
import com.jme3.input.MouseInput;
import com.jme3.math.Vector3f;
import com.jme3.niftygui.NiftyJmeDisplay;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial.CullHint;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeContext;
public class NiftyState2 extends AbstractAppState
{
protected Main main;
protected AssetManager assetManager;
protected AudioRenderer audioRenderer;
protected RenderManager renderManager;
protected AppStateManager stateManager;
protected Listener listener;
protected JmeContext context;
protected MouseInput mouseInput;
protected KeyInput keyInput;
protected JoyInput joyInput;
protected InputManager inputManager;
protected ViewPort viewPort;
protected ViewPort guiViewPort;
protected Node rootNode = new Node("Root Node");
protected Node guiNode = new Node("Gui Node");
protected Camera cam;
protected Camera guiCam;
private NiftyJmeDisplay niftyDisplay;
public NiftyState2(Main m, AppSettings settings)
{
main=m;
Application app=(Application)main;
assetManager=app.getAssetManager();
audioRenderer=app.getAudioRenderer();
renderManager=app.getRenderManager();
stateManager=app.getStateManager();
listener=app.getListener();
context=app.getContext();
mouseInput=context.getMouseInput();
keyInput=context.getKeyInput();
joyInput=context.getJoyInput();
inputManager=app.getInputManager();
cam = new Camera(context.getSettings().getWidth(), context.getSettings().getHeight());
cam.setFrustumPerspective(45f, (float)cam.getWidth() / cam.getHeight(), 1f, 1000f);
cam.setLocation(new Vector3f(0f, 0f, 10f));
cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
guiCam = new Camera(context.getSettings().getWidth(), context.getSettings().getHeight());
guiNode.setQueueBucket(Bucket.Gui);
guiNode.setCullHint(CullHint.Never);
}
public void activateState()
{
stateManager.attach(this);
viewPort = renderManager.createMainView("Main nifty2", cam);
viewPort.setClearFlags(true,true,true);
viewPort.attachScene(rootNode);
guiViewPort = renderManager.createPostView("Gui nifty2", guiCam);
guiViewPort.setClearFlags(false,true,true);
guiViewPort.attachScene(guiNode);
niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
niftyDisplay.getNifty().fromXml("Interface/nifty2.xml", "start", main);
guiViewPort.addProcessor(niftyDisplay);
}
public void deactivateState()
{
stateManager.detach(this);
if(viewPort!=null)
{
viewPort.setClearFlags(false,false,false);
renderManager.removeMainView(viewPort);
}
if(guiViewPort!=null)
{
guiViewPort.removeProcessor(niftyDisplay);
guiViewPort.setClearFlags(false,false,false);
renderManager.removePostView(guiViewPort);
}
}
@Override
public void update(float tpf) {
super.update(tpf);
rootNode.updateLogicalState(tpf);
rootNode.updateGeometricState();
guiNode.updateLogicalState(tpf);
guiNode.updateGeometricState();
}
}
[/java]
Interface/nifty1.xml
[xml]
<?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">
<!-- +++++++++++++++++++++++++++++++++++++++ -->
<!-- start screen -->
<!-- +++++++++++++++++++++++++++++++++++++++ -->
<screen id="start" controller="mygame.Main">
<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="nifty1()"/>
<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="NIFTY1" align="center" valign="center" />
</panel>
</layer>
</screen>
</nifty>
[/xml]
Interface/nifty2.xml
[xml]
<?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">
<!-- +++++++++++++++++++++++++++++++++++++++ -->
<!-- start screen -->
<!-- +++++++++++++++++++++++++++++++++++++++ -->
<screen id="start" controller="mygame.Main">
<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="nifty2()"/>
<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="NIFTY2" align="center" valign="center" />
</panel>
</layer>
</screen>
</nifty>
[/xml]
Thanks for any help you can provide
It might be the elements confliting the ids. Try giving unique ids for the elements of the 2 screens.
Can I know why are you extending the Application.java and not the SimpleApplication.java? The SimpleApplication one is more suitable. It just has “simple” on the name.