Archive for bubble

Nifty Slick Integration in Nifty Version 0.0.4

// August 3rd, 2008 // 8 Comments » // bubble

Slick 2D is a great library for game development. With the upcoming release of Nifty GUI 0.0.4 there will be an even easier way to integrate your Nifty GUI into your Slick application.

The current Nifty GUI Version 0.0.3 can already be used with Slick but it might become a little tricky to save/restore OpenGL state when switching between Slick and Nifty rendering. The basic approach would be to call niftys render() method after you’ve rendered all of your Slick graphics. This “manual” rendering is the usual way for Nifty integration and is shown in the Hello World example on the Nifty Project Website.

With the Release of Nifty Version 0.0.4 there will be a Slick GameState implementation available for easy of use. If you’re new to Slick GameStates there’s an article in the Slick wiki about the basic principles. With Nifty 0.0.4 you get a NiftyGameState class that extends the Slick BasicGameState. So you can simply use an instance of this new class (or a subclass) and voila you have the ability to add a Nifty GUI to your Slick app in no time :)

Example:

public void initStatesList(final GameContainer container) throws SlickException {
  NiftyGameState state = new NiftyGameState(MENU_ID);
  state.fromXml("mainmenu.xml", new ScreenController() {
    public void bind(Nifty nifty, Screen screen) {
    }
    public void onEndScreen() {
    }
    public void onStartScreen() {
    }
  });
  addState(state);
}

Nifty! :)

Nifty 0.0.2 Released

// May 4th, 2008 // No Comments » // bubble, demo

Removing XmlBeans and Commons-Logging reduced the nifty with all dependencies jar from 4,4 MB to 1,6 MB :)

Check it out here

Nifty Project Page at Sourceforge

or get the release here

Nifty Release Download

Have fun =)

Removing XmlBeans…

// April 20th, 2008 // No Comments » // bubble

Actually I like XmlBeans a lot. Define a XML-Schema (XSD) for your XML-File, throw XmlBeans at it and let it generate some Java classes. Voila. XML-Binding. Validate against the XML-Schema, easily access your XML-File from within Java, etc… XML? Java? Done!

There’s even a Maven Plugin for it, so one can generate the classes on the fly within your build process. Great Stuff!

So why would some half insane person want to removed it?

Well, one drawback is the size of the lib. Because XmlBeans is your Swiss army knife of XML-Java-Binding it is rather large being around 2,6 MB in size. Altough this is not that bad in DSL-century you can still notice it when running a Java Applet or Java Webstart.

Another and somewhat profoundly drawback is, that in a Java Webstart it seems to parse Xml-Files very very slow. I’m not sure what exactly causes this slowdown but from what I grasp this might be a classLoader issue or something. When run localy everything works fine but from within a Webstart Version it runs painfully slow. I’ve tried to pinpoint what causes these issues but had not much luck in doing so.

Now I’ve settled to get rid of XmlBeans and replace it with some simpler form of xml parsing. What I’m currently using is XPP3. Hopefully this will remove the issues. The lib is very small (25 KB) and very fast. The only drawback so far is that I lose the Schema-Validation. I’ll keep the XML-Schema for development and documentation purposes but the actual Loader inside Nifty won’t check against the Schema anymore. Which is a bit sad but something I can’t do anything about at this very moment.

sourceforge.net project on the way…

// April 12th, 2008 // No Comments » // bubble

I’m currently preparing the first alpha release of Nifty and moving the source over to sourceforge.net. This means you get access to the source as well as a first release of Nifty to play with.

There’s a new nifty-example.jar on the way too :)

Stay tuned … more news soon!

It works! Time to smash it apart :)

// December 16th, 2007 // No Comments » // bubble

Well it works… but as development progresses some, err, bad habits sneak it. There were a lot of features added to nifty in a relative short period of time and some of these features messed up the code as well as internal dependencies (I’m sure you know what I’m talking about…).

refactoring book

One thing I pretty much hate are inheritance dependencies. Sadly I’ve just introduced a fairly big one to manage all the controls in Nifty *sigh*

Well it’s time to get the refactoring hat on and clean up the mess :)

Btw: If you still need a christmas present (for yourself or some co-worker) I’d higly recommend the book:

Refactoring: Improving the Design of Existing Code” by Martin Fowler.

This book rocks :> I’ve learned a lot from it.

Nifty Blog Hello World

// November 29th, 2007 // No Comments » // bubble

I am going to use this blog to track development of nifty gui. The “nifty” gui for your java opengl/lwjgl application.