Archive for Uncategorized

In case you haved missed it …

// April 7th, 2010 // 1 Comment » // Uncategorized

… some very interessting developments are on the way:

http://jmonkeyengine.com/blog/blog/2010/04/06/jmonkeyengine-3-0-gets-a-very-nifty-gui/

http://www.jmonkeyengine.com/forum/index.php?topic=11246.msg98829#msg98829

:)

And besides that, the current Nifty SVN has all dependencies to LWJGL and Slick2D removed! :D Nifty is now completly independent of the actual rendering system!

There is a lwjgl-slick2d renderer already available here:
http://nifty-gui.svn.sourceforge.net/viewvc/nifty-gui/nifty-lwjgl-slick-renderer/trunk/

There is a work in progress JME2 renderer available here:
http://nifty-gui.svn.sourceforge.net/viewvc/nifty-gui/nifty-jme-renderer/trunk/

And the friendly people over at http://www.jmonkeyengine.com/ are already working on a JME3 nifty renderer too! :)

If you want to create your own Nifty renderer for some other rendering system, well, you can do that now too!

Take a look at the http://nifty-gui.svn.sourceforge.net/viewvc/nifty-gui/nifty/trunk/src/main/java/de/lessvoid/nifty/spi/ ServiceProviderInterface for Nifty rendering. What about a Java2D implementation? :D

void

Nifty 1.1 released

// March 22nd, 2010 // 7 Comments » // Uncategorized

Nifty 1.1 – Download it
Nifty 1.1 – View Changelog
Nifty 1.1 – Enjoy the Demo

And there is a special new tutorial/demo available too:
Nifty 1.1 – New Tutorial/Demo

nifty tutorial screenshot

nifty tutorial screenshot

have fun :)

New effect “gradient” Available

// December 6th, 2009 // No Comments » // Uncategorized

There is a new Effect available in SVN now. The “gradient” Effect allows you to draw vertical or horizontal gradients. You can use different colors and a percentage or pixel value for the position where the specific color should be.

Example:

<onActive name="gradient" direction="vertical">
  <value offset="0%" color="#f00f" />
  <value offset="20%" color="#0f0f" />
  <value offset="60%" color="#00ff" />
  <value offset="70%" color="#ff0f" />
  <value offset="100%" color="#ffff" />
</onActive>

Result:

Awesome! :D

You can use different Alpha Values for the colors too to make a gradient overlay elements or you could change the blendMode to multiply before applying the gradient with the “blendMode” effect :)

Have Fun!
void :)

Nifty Snapshots are now available

// December 6th, 2009 // No Comments » // Uncategorized

To get access to the latest and greates Nifty, Snapshots (= Development Versions) are now available at the Nifty Maven Repository I’ve set up at sourceforge.net.

You can get the latest Snapshot here: http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty/1.1-SNAPSHOT/

In case you’re using Maven you’ve probably already using this in your pom.xml:

<repositories>
  <repository>
    <id>nifty-maven-repo.sourceforge.net</id>
    <url>http://nifty-gui.sourceforge.net/nifty-maven-repo</url>
  </repository>
</repositories>

You only need to change your nifty dependency to snapshot and you’re always using the latest Nifty Build:

<dependency>
  <groupId>lessvoid</groupId>
  <artifactId>nifty</artifactId>
  <version>1.1-SNAPSHOT</version>
</dependency>

Good Luck and Have Fun!
void

Switching images with nifty effects in game

// November 1st, 2009 // 1 Comment » // Uncategorized

Someone over at the nifty forums asked how to switch images from java. You can find the thread and my answer here.

Well. So far so good but switching images can be a lot more exciting with nifty effects :)

So let’s start with adding a new effect and attach it to the image with the onCustom effect:

<image id="inventar" filename="icon1.png">
  <effect>
    <onCustom name="imageSize" startSize="1.7" endSize="1.0" length="150" />
  </effect>
</image>

This adds an “imageSize” effect that starts with a imagesize of 1.7 times the original size and resizes the image back to the original size over the time of 150 ms. The “onCustom” effect means, that we can trigger this effect from java.

So when it comes time to change the image to the rocket launcher, the plasma gun or the BFG9000 :D we can use the following java code to trigger the effect and change the image:

getElement("inventar").getRenderer(ImageRenderer.class).setImage(iconRocketLauncher)
getElement("inventar").startEffect(EffectEventId.onCustom);

The first line changes the image and the second line triggers the onCustom effect.

I’ve updated the slick overlay example with a little nifty image switching in the right upper border of the screen. You can change the different images with pressing the keys “a”, “b” and “c”.

You can find it here:

http://nifty-gui.sourceforge.net/webstart/nifty-slick-overlay-demo.jnlp

and you can find the updated 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)

Nifty! :D

Effect Reference with little animated gifs … soon

// October 17th, 2009 // No Comments » // Uncategorized

Ok, I was not able to add a effect reference each day but there was some progress, which is good.

Today I added “imageSize” and I’ve started to add little code snippets and animated gifs to the reference page too. So that the explanation makes more sense and you’ll get some code to start with.

I’ll continue to add effects documentation over the coming weeks :)

And here is the first with gif and code:

http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Effects#imageSize

Have fun,
void

To document one nifty effect each day project started =)

// October 3rd, 2009 // No Comments » // Uncategorized

I started to document the different nifty effects in the nifty wiki:

http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Effects

I’ll try to continue with documenting at least one effect each day :)

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

(more…)