I have some trouble with the delay command.
I want to show my logo for 2 seconds and then go to the MainMenu screen. But what it does is it shows a black screen for a couple of seconds, and goes to the MainMenu (I can see my logo for about 1ms):
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0.2f, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
game.batch.setProjectionMatrix(camera.combined);
game.batch.begin();
game.batch.draw(PGSImage, 0, 0);
game.batch.end();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
game.setScreen(new MainMenuScreen(game));
dispose();
}
What am I doing wrong?