Newbie setting up a project

Started by Dalendrion, January 31, 2011, 21:48:05

Previous topic - Next topic

Dalendrion

Greetings,

I am Dalendrion, a complete newbie when it comes to game development and fairly inexperienced with Eclipse.
I'm only just starting to explore LWJGL and Slick2D following the following tutorials:

Spiegel already warned that I shouldn't take the code literally, but so far things seemed to check out. However, I got the following console output:

usage:
XPMFile <file>
java.lang.ArrayIndexOutOfBoundsException: 0
	at org.lwjgl.util.XPMFile.main(XPMFile.java:260)


I'm using LWJGL v2.6. Is there anyone who can help me with this first hurdle?

kappa

that is an odd error, what is the code that you are using ?

Dalendrion

It's a single class with the code below:

package Game;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;

public class SimpleGame extends BasicGame
{

    public SimpleGame(String title)
    {
	super(title);
    }

    @Override
    public void init(GameContainer arg0) throws SlickException
    {
	
    }

    @Override
    public void update(GameContainer arg0, int arg1) throws SlickException
    {
	
    }

    @Override
    public void render(GameContainer arg0, Graphics arg1) throws SlickException
    {
	
    }
    
    public static void main(String[] args) throws SlickException
    {
	String title = "My Tutorial Game";
	AppGameContainer app = new AppGameContainer(new SimpleGame(title));
	app.setDisplayMode(600, 800, false);
	app.start();
    }
}

jediTofu

Not trying to be a jerk here, but have you asked in Slick2D's forums?  They're more likely to know what the problem is, and even if we find the problem, only they can fix it within the code (unless it's an LWJGL-specific error).

However, after looking at the official tutorials it looks as though you swapped width and height.  It should be this:

app.setDisplayMode(800, 600, false);

But that's just my guess.
cool story, bro

kappa

really confused how you are getting the "org.lwjgl.util.XPMFile.main(XPMFile.java:260)" error, since that is a class in lwjgl_util.jar and not something that Slick2D even uses nor is there any reference to it in the class you pasted above, just strange.

What i can suggest is if you have lwjgl_util.jar on the classpath try remove it.

Dalendrion

Yeah, I'm confused about this too. This is also why I didn't know where to look for help.

kappa

Well what I can suggest is you start again, create a new project and only add lwjgl.jar and slick.jar to it and then try your above code.

Dalendrion

I did what you advised, and noticed I missed the test data from Slick, added that and...



Guess I must be doing something right this time. Thanks!

At first I used lwjgl_util.jar and slick-util.jar. Maybe that's what I was doing wrong?


Edit: Emmmm, no... that wasn't it either. Apparently I had unknowingly set Eclipse to build a test application rather than my own. All is well now. I'm happily going through the tutorials making SlickBlocks to begin with.

jrm

I had this problem as well, I found that I had forgotten to set the native library location (look at the installation instructions for how to do this). Hope this will help someone.

/JRM