So i started looking around wiki , i am trying to make a little 2d game. I am using lwjgl and slick.
my debugger gives me this error run:
Exception in thread "main" java.lang.RuntimeException: Resource not found: startup.png
at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
at crazychickens.StartUpScreen.<init>(StartUpScreen.java:27)
at crazychickens.CrazyChickens.<init>(CrazyChickens.java:14)
at crazychickens.Game.main(Game.java:27)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
the filename is right. idk whats up.
I have 3 classes.
Game /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package crazychickens;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
/**
*
* @author Revix2k10
*/
public class Game {
//declarations
public static void main(String[] args) {
CrazyChickens gameObject = new CrazyChickens();
gameObject.start();
}
}
CrazyChickens
package crazychickens;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
/**
*
* @author Revix2k10
*/
public class CrazyChickens {
public int screenWidth,screenHeight;
StartUpScreen smenu = new StartUpScreen();
public CrazyChickens(){
screenWidth = 800;
screenHeight = 600;
}
public void start(){
try{
Display.setDisplayMode(new DisplayMode(screenWidth,screenHeight));
Display.create();
Display.setVSyncEnabled(true);
}catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
while (!Display.isCloseRequested()){
Display.update();
smenu.Render();
}
Display.destroy();
}
}
and start up screen
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package crazychickens;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.Color;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;
import java.io.IOException;
/**
*
* @author Revix2k10
*/
public class StartUpScreen {
private Texture startupScreen;
public StartUpScreen(){
try{
startupScreen = TextureLoader.getTexture("PNG",ResourceLoader.getResourceAsStream("startup.png"));
} catch (IOException e) {
e.printStackTrace();
}
}
public void Render(){
Color.white.bind();
startupScreen.bind();
}
}