线程“LWJGL Application”中的异常java.lang.NullPointerException Libgdx

时间:2014-07-04 00:34:27

标签: java eclipse libgdx

我一直得到这个例外,我不知道该怎么做。

线程“LWJGL Application”中的异常java.lang.NullPointerException     在com.Learning.Asteriods.MyGdxGame.create(MyGdxGame.java:34)     在com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)     在com.badlogic.gdx.backends.lwjgl.LwjglApplication $ 1.run(LwjglApplication.java:114)

public class MyGdxGame extends ApplicationAdapter
{
SpriteBatch batch;

public static int width;
public static int height;
public static OrthographicCamera camera;
private GameStateManager gameState;
PlayState playState;

@Override
public void create ()
{
    batch = new SpriteBatch();
    width = Gdx.graphics.getWidth();
    height = Gdx.graphics.getHeight();
    camera = new OrthographicCamera(width, height);
    camera.translate(width/2, height/2);
    camera.update();
    Gdx.input.setInputProcessor(new GameInputProcessor());
    playState.Initialize();
    gameState = new GameStateManager();
    playState = new PlayState(gameState);
}

@Override
public void render ()
{
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    gameState.Update(Gdx.graphics.getDeltaTime());
    gameState.Draw();
    GameKeys.Update();
}

0 个答案:

没有答案