Good tutorial or mechanics page / Basic questions

Hi! Now, after i barely find a away to show controls etc…, i hve some basic questions:

  1. how to hide screens/layer/elements correctly, e.g. you have a mainmenu, press play and the game starts. what to do with the mainmenu screen? iterate over all nifty.getCurrentScreen().getLayerElements() and call hide(); on it? Or do i need an empty screen and have to call gotoScreen(“empty”)?
  2. isn’t every single “page” a screen for itself? The tutorial.xml e.g. has a page concept differing hard from what i thought how to handle nifty, because the pages are no screens, actually they are just control-definitions which get changed. i thought that i have a screen for my mainmenu, a screen for my optionsmenu, one for the credits etc…

    3 How can i wait for all gui-operations done, before heading on? e.g. if i press a “new game”- button i want to fade or move the menu out, and then init the game. Status Quo: i call nifty.gotoScreen(“empty”) to get rid of the mainmenu on get the onScreenEnd-effects done, and initGame() after. But the onScreenEnd is (with delay), and the initGame() to fast or somethin.

    I have no feeling for what i can do in xml, and what i have to do in java…

    It were reallly nice if there is a expample *jar with a common menu or somethin, anything where i can see some mechanics of nifty. The wiki doesn’t help a lot.


I understand your problem, so far in JME nifty gui is the most annoying thing ive come across so far, have spent 3 days searching for examples and tutorials, I am going to update JME nifty gui wiki with stuff ive learnt in the past few days once ive figured out how to register onClick action to a ButtonBuilder so i can attach buttons to popup menus.

go under examples and find closest possible match, note: it requires quite a bit of exploring,

Java docs :

control Java docs :

nifty 1.2 tutorial/ goes over the basics :

i had trouble loading that ^ from the site, so i just right click saved as and ran it from local.

  1. Empty screen is a good solution, yeah
  2. Yeah
  3. Events that get triggered when e.g. a page loads… Normally however your code should know the state of the GUI and the corresponding actions.

I used layers which i set visible or hid with effects. I just stored the name of the actual layer in my controller and worked with that.

Im quite satisfied with that solution.