I would like to bring up a loading screen, for this would make the load async. How can I do this? I looked on the libGDX website but I do not understand very well, maybe because of my poor English.
Here's the code :
public void show() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png"))));
loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2);
loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2);
loading.setZIndex(1);
loading.addAction(rotateTo(1440, 20));
stage.addActor(loading);
game.setScreen(game.gameScreen);
}
What I would do is an async method like this:
asyncmethod()
public asyncmethod()
{
game.setScreen(game.gameScreen);
}
public void show() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
loading = new com.badlogic.gdx.scenes.scene2d.ui.Image(new TextureRegion(new Texture(Gdx.files.internal("loading.png"))));
loading.setPosition(Gdx.graphics.getWidth() / 2 - loading.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loading.getHeight() / 2);
loading.setOrigin(loading.getWidth() / 2, loading.getHeight() / 2);
loading.setZIndex(1);
loading.addAction(rotateTo(1440, 20));
stage.addActor(loading);
asyncmethod();
}