[Solved] Providing a ScreenController When Loading Several XML Files

Was trying to load several xml files in nifty, rather than packing all the screens into one (as the tutorial suggested), but for my game, I need to provide the screenController to be used AFTER it is initalized, as it is an AppState. (like you could do when doing nifty.fromXml(xml-file,screen,CONTROLLER)

you can use

[java]nifty.registerScreenController(new ScreenControllerSuperDuperAppState4000());

nifty.addXML("nifty.xml");[/java]



and then attach it to the AppStateManager when you need it

Ok, thank you so much for the help! May I ask where you found that, I’d just like to know, because I (thought) I’d searched everywhere…

good question and i don’t know (probably the forums somewhere), it doesn’t seem to be in the nifty bible or in the wiki, unless i’m blind also

register and addXml are both covered in the Nifty manual … and certainly in the API docs.

are you sure register is in the nifty manual? i can’t seem to find it in there.



In any event i added it to the wiki:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:nifty_gui_scenarios#register_additional_explicit_screen_controllers

@zarch:

I forgot about the nifty manual, and skimmed the API docs, I’ll read through them both next time.



@wezrule:

Thanks for adding it to the wiki.



Thank you both for your help :smiley: