Hey, can you guys help me out? I’m a complete noob but i’m really trying to learn, and right now my passion is playing around with jmonkey. I’m trying to design the gui for a simple game using nifty, but im having alot of problems with it. I have the xml part at my fingertips, but im having trouble loading the xml file. How do I instantiate the Nifty class? What packages do I need to import? Thanks
Yeah, thats basically what I did for MonkeyZone. Create an XML file, edited the basic layout in the editor and added the code to manipulate the GUI to my app and that was it. I don’t know whats wrong there.
If you are running stock alpha 4 with no nightly updates then I think you will run into lots of problems. For a long time the nifty examples didn’t work at all in JME.
Update to a nightly build so that those work and then use them as examples.
Regarding the “only one child shows up”, that’s probably because the parent’s child layout is set to “center” instead of horizontal or vertical.
If you want to have 2 textfield which are below each other and together they are centered, you would have one panel with childrenlayout=“center”. This one can only contain 1 element though, so in there you put another panel. This panel you give a childrenlayout=“vertical”. And in here you put your 2 textfield controls.
Nifty, although a great GUI tool, can seem spaghetti-like at times. We sure can’t blame void though as he is actively working on implementing stuff we want to have and fixing version 1.3. I know I feel bad just by posting here in the GUI forum. On the other hand, having coherent documentation and examples are what software acceptation and usage is all about.
What’s the use of a fantastic tool if nobody can understand how it works right? It isn’t the case with Nifty, but there are things that do seem that way at times.
I checked out the blog and it was very helpful, thanks However, i’m now currently trying to add more than one panel to a screen using nifty, and i have no idea how to go about this. By more than one panel i mean independent panels which have different effects, colors, texts, etc. Any advice on how to go about this?
This is a bug (or the nifty libs in the jME3 nightly are out of date). It eluded me all morning. I updated my jME3 to the latest nightly with no change. I replaced the nifty snapshots with the latest from the nifty maven repo and everything worked as expected. Replace the nifty*-SNAPSHOT.jar files in the jME3/lib folder with the latest from the maven repo. (You'll need to rename the files or adjust your classpath)
The draggable windows are working in jME3_2011-05-11 after replacing the nifty libs with the 20110508 snapshots from the maven repo.
At a minimum you'll want these:
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty/1.3-SNAPSHOT/
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty-default-controls/1.3-SNAPSHOT/
It probably won't hurt to grab the latest styles and examples:
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty-style-black/1.3-SNAPSHOT/
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty-examples/1.3-SNAPSHOT/