How can someone resize the NiftyJmeDisplay? For example, the canvas first has a dimension of 800 by 600, the user resizes the window, and then the canvas gets redrawn to the new dimension of 1440 by 900.
It’s easily done by reloading the entire XML configuration like this:
[java]
display.reshape(null, 1440, 900); //done dynamically in the real code
Nifty nifty = display.getNifty();
nifty.fromXml(“Interface/lobby.xml”, “login”, controller);
[/java]
But reshaping the display after loading from XML doesn’t resize the screen. If you reload the screen from XML, you loose all the information the user has contributed (so that’s not an optimal solution). That works though, so if there was a way to keep user input, but still having to reload the screen, I’d be happy as well.
I’ll post a screenshot as example:
http://img204.imageshack.us/img204/4224/niftyguiresizeproblem.png
If you guessed the login should be centered, you guessed correctly.
I created a sample project that demonstrates this issue:
http://www.lefke123.com/private/downloads/resizable-jme.zip
Thanks in advance!
Looks like this is something that should be implemented on the nifty gui side? How about a Nifty.reshape/resize method?
In the meantime, I’ve created a simple project that demonstrates the functionality:
http://www.lefke123.com/private/downloads/resizable-jme.zip
There already is a feature request in the feature request tracker here → http://sourceforge.net/tracker/?func=detail&aid=3005778&group_id=223898&atid=1059825
… and I’m currently working on this because it’s one of the final things to be done before 1.3. and to be honest it gives me headaches
… but yeah, I’m working on it!
Thanks a lot. If you need any help, just let me know.
Ok, this is in SVN now and there is a new blog post online with a quick video http://nifty-gui.lessvoid.com/archives/269 demonstrating it.
Not tested with JME3 yet but it should work there as well.
Please complain in here, if it does not
Nice work void!