简体   繁体   English

如何关闭在LIbgdx中使用多个屏幕的游戏

[英]How to close a game that uses multiple Screen in LIbgdx

I have a class that extends Game , then a bunch of other classes that implements Screen and because of that I can just do this game.setScreen(new MyScreen(game)); 我有一个扩展Game的类,然后是一堆实现Screen的其他类,因此我可以做这个game.setScreen(new MyScreen(game)); but the problem is that when I do Gdx.app.exit() it just closes the current screen and go to the next one, this is the same for game.dispose() .So how do you close or exit the game when it's running as desktop or android application? 但是问题是当我执行Gdx.app.exit()它只是关闭当前屏幕并转到下一个屏幕,对于game.dispose()来说是相同的。那么,如何关闭或退出游戏呢?作为桌面或android应用程序运行?

You could try doing System.exit(0) , which should work. 您可以尝试执行System.exit(0) ,它应该可以工作。

I believe (although I haven't tested this one out), you can also add the line: config.forceExit(false) whereas it was previously set to true. 我相信(尽管我还没有对此进行测试),但是您也可以添加以下行: config.forceExit(false)而之前它已设置为true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM