2012-08-17 3 views
0

안녕하세요, slick2D 및 lwjgl 2.8.4를 사용하여 Java 게임을 만들려고합니다. 하지만 AppGameContainer 클래스를 구현할 수 없습니다. 런타임 오류가 발생합니다. 내 코드는 아래와 같습니다 :AppGameContainer를 사용하는 동안 java slick2D 프로젝트에서 런타임 오류가 발생했습니다.

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 Main(String title) { 
    super(title); 
    // TODO Auto-generated constructor stub 
    } 




    public static void main(String args[]) throws SlickException{ 
    AppGameContainer app = new AppGameContainer(new Main("Tower Defence")); 
    app.setDisplayMode(800, 600, false); 
     app.start(); 

    } 

    @Override 
    public void render(GameContainer container, Graphics g) 
     throws SlickException { 
    // TODO Auto-generated method stub 

    } 

    @Override 
    public void init(GameContainer container) throws SlickException { 
    // TODO Auto-generated method stub 

    } 

    @Override 
    public void update(GameContainer container, int delta) 
     throws SlickException { 
    // TODO Auto-generated method stub 

    } 

    } 
다음

내가 얻을 다음과 같은 런타임 오류 : 가 enter image description here

이 일식 내 패키지 탐색기가 아래와 같습니다 :

enter image description here

어떻게이 오류를 피할 수 있습니까?

답변

1

그래픽 카드 드라이버가 설치되지 않았습니다. 그래픽 카드 드라이버를 설치하면 문제가 해결되었습니다.

0

이 시도 : 어떻게 항상 구조 내 꺼야

public static void main(String[] args) { 

    AppGameContainer app; 

    try { 

     app = new AppGameContainer(new Main("Tower Defence")); 
     app.setDisplayMode(800, 600, false); 
     app.start(); 

    } catch (SlickException e) { 

     e.printStackTrace(); 

    } 

} 

.

관련 문제