Archive for the ‘bubble’ Category

Dynamically Changing Button Text/Width and the Centerlayout

Sunday, February 21st, 2010

Jattra tries to dynamically change button text from within Java and he needs a Button that automatically resizes according to the width of the changed text.

You can follow both threads at the Nifty Help Forum at sf.net:

Read the complete blog post for details.
(more…)

New Feature - Keyframes for Nifty Effects

Tuesday, October 27th, 2009

Well, I’m currently rewriting the old Nifty Introduction Demonstration that somehow didn’t survive my last blog server switch :( It was posted right here but the jnlp disappear. The demo explained some basic concepts of Nifty and it was written in Nifty :) I’m rewritting it now to update it to the current Nifty Standards.

In the process I just want a moving Nifty GUI Logo like this one

So the logo should resize while fading in and keep on resizing while fading out.

(more…)

So and what’s next?

Saturday, August 29th, 2009

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!

1.0 - RC 1

Sunday, March 29th, 2009

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

Updated Slick and Lwjgl Library Versions + More Maven Love

Saturday, March 14th, 2009

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! :D

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! :D

Improved support for dynamically created Controls

Monday, March 9th, 2009

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 :)

Well …

Thursday, February 12th, 2009

… actually I really want to release Nifty 1.0 at the end of 2008.

But as we added feature after feature, well, things got a bit unstable and pretty ugly (To be honest … fubar :). So some parts of the controls broke, some demos broke and parts of nifty turned to crap.

I tried to fix it, but especially the loading code (loading xml and creating the runtime nifty object tree from it) got to messed up for any repair.

So we took a break from it.

But now we’re back! :)

I’ve started rewritting the loader code and everything looks shiny, new and great again. It’s not finished yet (control loading is still missing) but it’s looking much cleaner than the old stuff.

BTW: I’ve invented a small little side project while rewritting the loader. It’s kinda another XML Java Binding Project that is based around my own little XML-Schema Definition called “Lightweight XML Schema” (lwxs). The project still relies on XPP3 for xml parsing. You can basically describe what your xml file looks like (exactly like XSD but much simpler) and then you can easily read a matching XML file to some representation in java. It’s all very simple but made the loader pretty easy :)

And mind you, only the loader was broken! The Nifty core engine has not been changed and is still pretty solid :D

So hang on! Great things are about to happen!
void

PS: New Wiki Documentation Project for Nifty GUI started.
PPS: Nifty 1.0 - probably available this year! :o)

Nifty Slick Integration in Nifty Version 0.0.4

Sunday, August 3rd, 2008

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

Sunday, May 4th, 2008

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…

Sunday, April 20th, 2008

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.