Archive for the ‘docs’ Category

Nifty plays well with others and of course with slick2d too

Sunday, September 13th, 2009

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

Slick Overlay with Nifty GUI

Slick Overlay with Nifty GUI

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.

(more…)

Nifty Sourceforge.net Updates

Saturday, April 4th, 2009

We’ve added a new Wikipage that gives an Introduction to the Nifty Style System:

Effect Tutorial/Introduction

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:

Nifty Gallery at Sourceforge

Nifty Forum at Sourceforge

Have fun,
void =)

wiki updated

Saturday, March 14th, 2009

Adding Documentation on how and where to “svn checkout” Nifty and how to build it with Maven:

Building Nifty from Source Wiki Page

:D

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

Effects Reference added to Wiki

Sunday, February 15th, 2009

A Nifty Effects Reference Page has been added to the Nifty Gui Wiki at sourceforge.net :) It’s still work in progress but it already lists all standard effects that are available and it documents all of the standard parameters that are available.

void

How to use the Drop Down Control

Sunday, December 7th, 2008

Nifty 0.0.5 adds support for a Drop Down Control. Here we show how to actually use it.

XML

First of all you need to add the standard Nifty controls to your xml. To keep things easy for the moment we use the default Nifty styles too.

<!-- load default styles and controls -->

So adding a Drop Down Control works like adding any other control:

Basically you address the control you want to add, in this case it’s “dropDownControl”. And you need to give your control an id too, so that you can reference it later (”dropDown1″).

(more…)

Create your own Nifty Panel Styles - it’s easy! :D

Saturday, November 8th, 2008

To customize and extend the default nifty styles is easy. In this example you add your own panel style :)

Default Styles
Nifty default styles need to be included using the <useStyle> tag:

 <!-- include the default styles-->

To actual use this Style for a panel you use the “style” Attribute in the <panel> tag:

 <!-- panel with "nifty-panel" style -->

When you’re using the two (!) lines you’ll get the well known default “yellow, red, black” colored panel:

default panel style

default panel style

(more…)