过去3周我一直在使用libgdx
..
我创建了两个引用游戏的屏幕:
public class Game extends Game {
TitleScreen titleScreen;
SplashScreen splashScreen;
@Override
public void create() {
// TODO Auto-generated method stub
titleScreen = new TitleScreen(this);
splashScreen = new SplashScreen(this);
setScreen(splashScreen);
}
}
和
public class SplashScreen implements Screen {
Game game;
public SplashScreen(Game game) {
// TODO Auto-generated constructor stub
this.game = game;
}
@Override
public void show() {
// TODO Auto-generated method stub
}
@Override
public void hide() {
// TODO Auto-generated method stub
}
@Override
public void render(float delta) {
// TODO Auto-generated method stub
Gdx.gl.glClearColor(0.5f, 1f, 1f, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
if(Gdx.input.justTouched()){
game.splashScreen.dispose();
game.setScreen(game.titlescreen);
}
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
如何完全处理splashscreen
?当我在game.setscreen(game.splashscreen)
课程中拨打titlescreen
时,它会恢复splashscreen
;.我期待设置一个新的splashscreen
..
答案 0 :(得分:0)
每次要从头开始显示启动时创建一个新的启动画面:
game.setScreen(new SplashScreen(game));