0
我嘗試編寫引導屏幕來測試遊戲。當我嘗試運行此代碼時,出現了一些錯誤。我正在尋找一些有關任何具體但沒有學到的信息,另外,有人提到我沒有圖形驅動程序,但我有圖形驅動程序:)Java Slick2D&lwjgl
package JaAdrian.MyGame;
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 Main extends BasicGame {
public static final String NAME = "SampleTest";
public Main() {
super(NAME);
}
public void render(GameContainer gc, Graphics g){
}
@Override
public void init(GameContainer gc) throws SlickException {
}
@Override
public void update(GameContainer gc, int g) throws SlickException {
}
public static void main(String[] args){
try {
AppGameContainer app = new AppGameContainer(new Main());
app.setDisplayMode(800, 600, false); //true == fullscreen
app.setTargetFrameRate(60);
app.setAlwaysRender(true);
app.setUpdateOnlyWhenVisible(false);
app.start();
} catch (SlickException e) {
e.printStackTrace();
}
}
}
當我嘗試測試它,我有錯誤:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:34)
at JaAdrian.MyGame.Main.main(Main.java:35)