My Writings. My Thoughts.
Another shorter solution to the Nifty Overlay
// September 13th, 2009 // 3 Comments » // Uncategorized
Nifty and Slick User Tobse pointed out that you can use the NiftyGameState to create overlays too.
I like his version because it is shorter and much of the details of how the integration with Nifty works (calling render and forwarding input events to Nifty) are hidden from you. However the class NiftyGameState has been designed as a base class for a real Nifty GUI State and was not really planned for overlay rendering.
So I think although both versions work there is still something missing (in both versions). I like the idea of hidding the details on one hand but I’m not sure if using the NiftyGameState is really the way to achieve this.
What do you think?
Click the “Read More” link to see the short version of TestState that Tobse wrote and which is less code than my initial version
Nifty plays well with others and of course with slick2d too
// September 13th, 2009 // 2 Comments » // design, docs
Nifty can be used as a standalone GUI. So when your game enters its menu or option screens Nifty is all there is on the screen and all user input is handled by Nifty.
When using Nifty together with Slick2d this is represented by the NiftyGameState class. Using this class your Slick2d StateBasedGame can easliy switch from your in game state to the NiftyGameState and display the GUI.
But this is not the only way Nifty can be used. You can easily use Nifty to render your in-game GUI too! Nifty plays well with others (as long as they use OpenGL/lwjgl for rendering that is).
It’s not complicated at all and I wanted to write example code that demonstrates how easy it is for a long time. Motivated by a question at the Nifty Forum at souceforge.net I did now
What’s demonstrated in the new slick example is, how you can use Nifty to render a GUI on top of a normal slick GameState.
Here is a screenshot of the example which renderes Text from within Slick that changes color when you press the keys 1-3. On top of this it renders a Nifty GUI that responds to mouse events. Additionally if you press 1-3 the colored Nifty boxes start to shake
You can try it out with the Webstart:
http://nifty-gui.sourceforge.net/webstart/nifty-slick-overlay-demo.jnlp
and you can find the example in svn or you can browse it online here:
http://nifty-gui.svn.sourceforge.net/viewvc/nifty-gui/nifty-examples/trunk/src/main/java/de/lessvoid/nifty/examples/slick/niftyoverlay/ (Java classes)
http://nifty-gui.svn.sourceforge.net/viewvc/nifty-gui/nifty-examples/trunk/src/main/resources/slick/niftyoverlay/overlay.xml?revision=534&view=markup (Nifty XML for the Screen – overlay.xml)
Keep reading the full Article to see the details on how we get this to work and what you need to consider.
So and what’s next?
// August 29th, 2009 // No Comments » // bubble
Well, Nifty 1.0 should be quite stable now. It’s probably not perfect yet but you already get a whole lot to play with already
So, what’s next with Nifty?
Write more Documentation:
- Programmers Manual / Introduction to Nifty as a little PDF book is planned. Looking forward to this!
- Reference Wiki for all the Effects and Element Attributes and so on
Make it more usable:
- Allow another “language” to define the GUI in (besides XML). Maybe a DSL in groovy or scala or something else
- Fix bugs and other issues
- Improve the Layout Part and make this more easy and accessible
Make it more modular:
- Nifty now depends on Slick for Sound and Image handling. Some people reported that they don’t want to be forced to be dependent on Slick. So to have Slick as an Option would be a plus (this is already prepared for but was too much work to finish for 1.0
- Make even better Slick integration xD
- Split Nifty into even more modules so that you can only use the part you need (effects for instance could be another jar)
And that’s the current plan!
Have fun!
Nifty 1.0 released
// August 29th, 2009 // 2 Comments » // release
Well, it’s about time:
Nifty 1.0 – Download it
Nifty 1.0 – View Changelog
Nifty 1.0 – Enjoy the Demo
have fun
Nifty Sourceforge.net Updates
// April 4th, 2009 // 1 Comment » // docs
We’ve added a new Wikipage that gives an Introduction to the Nifty Style System:
It’s not completly finished yet but should give you some more informations about effects in Nifty.
Additionally we’ve removed the old Screenshots Page from the sf.net Nifty project website and enabled the much cooler gallery feature. And there is now a sf.net standard forum enabled for the Nifty project too:
Have fun,
void =)
1.0 – RC 1
// March 29th, 2009 // No Comments » // bubble
I’ve just commited some final changes to the loader to svn.
Finally everything is in place again. Changing the loading code was a lot more work than expected. But adding a preprocessing step was the key to solve all the issues and get the code much cleaner.
As an additional benefit nifty now knows for every attribute from which style it came from. So removing a style and replacing it with another one on the fly is supported
We’re now testing the current version in svn with an actual game. When everything works ok the 1.0 release of nifty gui will be available soon – for real this time
In the meantime you can follow nifty development at twitter
wiki updated
// March 14th, 2009 // No Comments » // docs
Adding Documentation on how and where to “svn checkout” Nifty and how to build it with Maven:
Building Nifty from Source Wiki Page
Updated Slick and Lwjgl Library Versions + More Maven Love
// March 14th, 2009 // No Comments » // bubble, docs
I’ve now updated the Nifty Dependencies in SVN (for the Nifty 1.0 Release) to the following Versions:
- Slick #239
- Lwjgl 2.0.1
Besides that I realized that I’ve already had setup a Nifty Maven Repository at Sourceforge. This was meant to store Nifty releases to allow other Projects that use Maven and Nifty to easily access the Nifty libs. So for instance you just need to add:
<repositories> <repository> <id>nifty-maven-repo.sourceforge.net</id> <url>http://nifty-gui.sourceforge.net/nifty-maven-repo</url> </repository> </repositories>
to your applications pom.xml and it will automatically find the Nifty dependency
So far so good.
BUT
Today I realized that I could use the same approach to get Lwjgl and Slick2D easily under Maven control. So when switching the Versions to Slick #239 und Lwjgl 2.0.1 I deployed both libs to the Nifty Maven Repo at Sourceforge!
So what does this mean for you?
It means just one thing. It’s now easier then ever to build Nifty! Just “svn co” it from Sourceforge and execute “mvn package” and it should automatically download all required libs without any changes!
Nifty!
Wiki Updated
// March 9th, 2009 // 1 Comment » // Wiki Update
Screen Reference added to Nifty Wiki
more planed. stay tuned
Improved support for dynamically created Controls
// March 9th, 2009 // No Comments » // bubble
Nifty was meant to read everything from XML files. But sometimes this is not enough because you need to decide from within your code what needs to be created.
This was possible in older versions of Nifty but was kinda tricky.
With Nifty 1.0 (currently available in svn) this has been improved. There are now special classes available to create and configure the build-in elements like Panel, Text, Label and Image.
Example use:
CreatePanel createPanel = new CreatePanel(); createPanel.setChildLayout("horizontal"); createPanel.setHeight("8px"); createPanel.create(nifty, screen, parent);
There is now even support to dynamically create your controls with a CreateCustomControl class.
Nifty stuff




