Ich versuche, meine Hauptklasse zu meinem Bildschirm Bildschirm Klasse zu bekommen.Wenn ich versuche, die Desktop-Anwendung das einzige, was passiert, ist, dass ein Fenster mit einem schwarzen Hintergrund öffnet und bleibt eine halbe Sekunde auf und schließt dann und ich habe keine Ahnung, warum es nicht funktioniert. Ich benutze Netbeans, wenn das etwas damit zu tun hat.Libgdx - Spiel schließt sofort nach dem Start Bildschirm
Hier ist meine Hauptklasse:
public class MyGdxGame extends Game {
public SpriteBatch batch;
@Override
public void create() {
batch = new SpriteBatch();
this.setScreen(new GameScreen(this));
}
@Override
public void render() {
super.render();
}
}
und hier ist mein Bildschirm Klasse:
public class GameScreen implements Screen{
Texture texture;
private MyGdxGame game;
public GameScreen(MyGdxGame game) {
this.game = game;
texture = new Texture("badlogic.jpg");
}
@Override
public void show() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void render(float f) {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
game.batch.begin();
game.batch.draw(texture, 0, 0);
game.batch.end();
}
//I havn't touched the other methods so I didn't paste them.
ich nicht die Desktop-Klasse berührt haben.
Ich bekomme diese Fehlermeldung:
Exception in thread "LWJGL Application" java.lang.UnsupportedOperationException: Not supported yet.
at com.mygdx.game.GameScreen.show(GameScreen.java:27)
at com.badlogic.gdx.Game.setScreen(Game.java:61)
at com.mygdx.game.MyGdxGame.create(MyGdxGame.java:14)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:147)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)
Es sieht so aus, als ob Ihre 'GameScreen.show()' Methode, die die 'UnsupportedOperationException' auslöst, aufgerufen wird; bietet die Bereitstellung einer geeigneten Implementierung für diese Methode Hilfe? – Castaglia