[SOLVED] Does Nifty not work with 3.1?

Hey everyone,

I’m finally working with Nifty again, and I got a weird problem. I wrote a very basic xml, but when I added the useStyles and useControls it didn’t work (the screen wasn’t recognized). I put them on the end of the xml and it did work, partially. I based it on something I wrote on the old SDK, from 3.0.
Now, the text isn’t shown.

Here is the XML:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.lessvoid.com/nifty-gui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd">

    <screen id="start">
        <layer id="background" childLayout="horizontal">
        <layer id="foreground" childLayout="horizontal">
            <panel id="left_buttons" childLayout="center" width="50%" height="100%">
                <text text="text" />
    <useControls filename="nifty-default-controls.xml"/>
    <useStlyles filename="nifty-default-styles.xml"/>

Am I doing something wrong in the xml?

I just looked up one of my screen files. The only thing I noticed that I am using a different <nifty>-tag

<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">

Not sure if it will help, but maybe you could just try it out. Please tell me if it worked or not.

Nope… same problems.

That only changes the Nifty version

Okay, sorry then. Maybe the core devs can help you.

I really do think it has something to do with 3.1 ; nifty 1.3 doesn’t work , nifty 1.4 doesn’t, and the XML is really basic. The only thing I did differently was 3.1 and the use of an AppState. Does it have to do with that?

I am really not sure but could it be that nifty doesn’t find their own “nifty-default-controls.xml” and “nifty-default-styles.xml” !? When you put that in the end maybe there is no style and control available and because of that the text cannot be shown.

Yeah, I had to import Nifty libs from the SDK
Maybe that’s the problem.

Did you solve it ?

Nope, looked at the libs, everything seems pretty normal.

Nifty works fine in 3.1… What does your code look like where you initialize nifty? Also, i’m not sure the text tag works like that anymore. I think that was depreciated a long time ago in nifty.

Here it is:

    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
        this.app = (SpaceApp) app;
        //1. Create Nifty from .XML
        NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay(
                app.getAssetManager(), app.getInputManager(), app.getAudioRenderer(), app.getGuiViewPort());
        nifty = niftyDisplay.getNifty();
        nifty.fromXml("Interface/mainmenu.xml", "start");

What is the actual error message you are getting in the log?

jun 16, 2016 5:36:44 PM de.lessvoid.nifty.Nifty gotoScreenInternal
WARNING: screen [start] not found

I take it this code is in an app state of some sort? Why are you immediately detaching the app state?

Yes, it’s ann appstate. I’m immediatly detaching, as there was no point of leaving the menu on, and I was testing the following appstate. Even if you remove it , the problem stays.

If you remove it does the log error go away? Because I just added your code to a test project and there is no error but there still is a black screen.

Also, I’m pretty sure the Text tag was depreciated a long time ago and i’m not sure that it works.

But it still worked a month ago

ADD: the error is gone.

Yes, but it probably was removed in 3.1 if it worked in 3.0.

Aha. If I replace text with control, it still does not work.