Search code examples
javaslick2d

Integration of Nifty in Slick, tutorial is there


I'm trying to get to use Nifty in my Slick game. However, i can't figure how to even get started. I've found this tutorial:

http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Nifty_Slick_Renderer_(Nifty_1.3.1)#Slick2D-Game_Implementations

But as i am very new at Java, i have no idea where to put the code lines in the tutorial. For instance, i probably need this:

// in NiftyGame, NiftyBasicGame, NiftyOverlayGame and NiftyOverlayBasicGame
protected void initGameAndGUI(GameContainer container) throws SlickException;

How can i add this to my Slick game?


Solution

  • What the comment // in NiftyGame, NiftyBasicGame, NiftyOverlayGame and NiftyOverlayBasicGame means is the class that you write should extend one of these classes (NiftyGame, NiftyBasicGame, NiftyOverlayGame). Then you'll want to implement some logic - refer to the link you provided for details on which functions you'll want to override to do this. Hope this helps you get started.