我创建了一个Libgdx游戏,我想知道是否可以使用Libgdx调用覆盖暂停方法生命周期?
下面是我的类中的暂停方法生命周期:
public class MyGdxGame extends ApplicationAdapter {
@Override
public void pause() {
super.pause();
chrono.pause();
//Display a pause menu
}
}
我想在单击暂停图像时调用生命周期方法:
imagePause = new Image(new Texture(Gdx.files.internal("pause.png")));
imagePause.setSize(pauseSize, pauseSize);
imagePause.setPosition(width - pauseSize, height - pauseSize);
imagePause.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
//Something like this? :
Gdx.app.pause(); //Doesn't exist
//I don't want to call manually the pause method like this
//because it doesn't pause Libgdx lifecycle ...
pause();
}
});
stage.addActor(imagePause);
知道吗?