我正在通过本教程学习libGDX:http://www.kilobolt.com/day-4-gameworld-and-gamerenderer-and-the-orthographic-camera.html
当我尝试运行DesktopLauncher时遇到问题,经过多次研究,没有人遇到同样的问题:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: com.kilobolt.gameworld.GameWorld.update(F)V
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:131)
Caused by: java.lang.NoSuchMethodError: com.kilobolt.gameworld.GameWorld.update(F)V
at com.kilobolt.screens.GameScreen.render(GameScreen.java:19)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:223)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)
Process finished with exit code 0
这是我的GameScreen类:
package com.kilobolt.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.kilobolt.gameworld.GameRenderer;
import com.kilobolt.gameworld.GameWorld;
public class GameScreen implements Screen {
private GameWorld world;
private GameRenderer renderer;
public GameScreen() {
Gdx.app.log("GameScreen", "Attached");
world = new GameWorld();
renderer = new GameRenderer();
}
@Override
public void render(float delta) {
world.update(delta);
renderer.render();
}
@Override
public void resize(int width, int height) {
}
@Override
public void show() {
Gdx.app.log("GameScreen", "show called");
}
@Override
public void hide() {
Gdx.app.log("GameScreen", "hide called");
}
@Override
public void pause() {
Gdx.app.log("GameScreen", "pause called");
}
@Override
public void resume() {
Gdx.app.log("GameScreen", "resume called");
}
@Override
public void dispose() {
// Leave blank
}
}
我的GameWorld课程:
package com.kilobolt.gameworld;
import com.badlogic.gdx.Gdx;
public class GameWorld {
public void update(float delta) {
Gdx.app.log("GameWorld", "update");
}
}
我的GameRenderer课程:
package com.kilobolt.gameworld;
import com.badlogic.gdx.Gdx;
public class GameRenderer {
public void render() {
Gdx.app.log("GameRenderer", "render");
}
}
感谢您的回答。