1. <tfoot id='HXRfM'></tfoot>
          <bdo id='HXRfM'></bdo><ul id='HXRfM'></ul>
        <i id='HXRfM'><tr id='HXRfM'><dt id='HXRfM'><q id='HXRfM'><span id='HXRfM'><b id='HXRfM'><form id='HXRfM'><ins id='HXRfM'></ins><ul id='HXRfM'></ul><sub id='HXRfM'></sub></form><legend id='HXRfM'></legend><bdo id='HXRfM'><pre id='HXRfM'><center id='HXRfM'></center></pre></bdo></b><th id='HXRfM'></th></span></q></dt></tr></i><div id='HXRfM'><tfoot id='HXRfM'></tfoot><dl id='HXRfM'><fieldset id='HXRfM'></fieldset></dl></div>
      2. <legend id='HXRfM'><style id='HXRfM'><dir id='HXRfM'><q id='HXRfM'></q></dir></style></legend>
      3. <small id='HXRfM'></small><noframes id='HXRfM'>

        如果在启动画面打开时中断游戏崩溃 - LIBGDX

        时间:2023-07-27
            <bdo id='9IvrJ'></bdo><ul id='9IvrJ'></ul>
          • <legend id='9IvrJ'><style id='9IvrJ'><dir id='9IvrJ'><q id='9IvrJ'></q></dir></style></legend>
                <tbody id='9IvrJ'></tbody>

              <tfoot id='9IvrJ'></tfoot>
              <i id='9IvrJ'><tr id='9IvrJ'><dt id='9IvrJ'><q id='9IvrJ'><span id='9IvrJ'><b id='9IvrJ'><form id='9IvrJ'><ins id='9IvrJ'></ins><ul id='9IvrJ'></ul><sub id='9IvrJ'></sub></form><legend id='9IvrJ'></legend><bdo id='9IvrJ'><pre id='9IvrJ'><center id='9IvrJ'></center></pre></bdo></b><th id='9IvrJ'></th></span></q></dt></tr></i><div id='9IvrJ'><tfoot id='9IvrJ'></tfoot><dl id='9IvrJ'><fieldset id='9IvrJ'></fieldset></dl></div>

              <small id='9IvrJ'></small><noframes id='9IvrJ'>

                • 本文介绍了如果在启动画面打开时中断游戏崩溃 - LIBGDX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  I have a splash screen and a menu screen class that loads all my texture atlases and skins for the menu and processes lots of stuff. If I put the constructor for the menu screen in the SplashScreen constructor or in the create() method of my main game class (MyGame class) then it would pass a lot of time with no splash screen render image on the phone while the whole stuff loads so I have delayed the loading of the menu class to the second frame render (gets called in the SplashScreen render method in the second frame); I simply check if I passed the first frame then I call a method on the main game class that loads the menus.

                  It all works fine , as expected , but only if the SplashScreen load process is not interrupted. If I get a call or I simple press the HOME button of the mobile and then I re-enter the game by clicking the icon on the home screen I get an AndroidGraphics error : "waiting for pause synchronization took too long: assuming dead lock and killing"; this is just after I can see the splash screen on the screen for about a second;

                  I tried to dispose the MyGame in the hide() and pause() methods of both the main game class and the splash screen class so it's terminated if I press the HOME button but they never get called.

                  How can I fix this? It would be annoying to get a call while loading the game and after you finish the call and try to re-enter the game it crashes.

                  public class MyGame extends Game{
                      ...
                      public MainMenu menu;
                      ...
                      @Override
                      public void create(){ 
                          this.screen_type == SCREEN_TYPE.SPLASH;
                          splashScreen = new SplashScreen();
                          setScreen(splashScreen);
                      }
                      ...
                      @Override 
                      public void pause(){
                          //never gets called if I press the HOME button in middle of splash screen
                          if(this.screen_type == SCREEN_TYPE.SPLASH)
                          {
                              this.dispose();
                          }
                      }
                      ... 
                      public void LoadMenuTimeConsumingConstructor(){
                          //load all menus and process data
                          main_menu = new MainMenu();
                          loaded_menu = true;
                      }
                  }
                  
                  public class SplashScreen implements InputProcessor, Screen{
                  
                      public MyGame main_game;
                      ...
                      public SplashScreen(MyGame game){
                          this.main_game = game;
                      }
                  
                      @Override
                      public void pause(){
                          //never gets called if I press the HOME button in middle of splash screen
                          if(main_game.screen_type == SCREEN_TYPE.SPLASH)
                          {
                              main_game.dispose();
                          }
                      }
                  
                      @Override 
                      public void hide(){
                          //never gets called if I press the HOME button in middle of splash screen
                          if(main_game.screen_type == SCREEN_TYPE.SPLASH)
                          {
                              main_game.dispose();
                          }
                      }
                  
                      @Override 
                      public void render(delta float){
                          ...
                  
                          //wait 1.5 sec
                          if(TimeUtils.millis() - startTime > 1500){
                          {
                              if(main_game.loaded_menu = true){
                                  main_game.setScreen(main_game.main_menu);
                              }
                  
                          } 
                  
                          ...
                  
                          if(is_this_second_frame){  // we start loading menus in the second frame so we already have the splash onscreen
                              main_game.LoadMenuTimeConsumingConstructor();
                          }
                  
                          ...
                      }
                  }
                  

                  解决方案

                  I do not understand your question very well, but if you are not using AssetManger Class, I think this read can help, I hope so.

                  If this response is not valid or not useful to you, tell me, and delete

                  wiki LibGDX https://github.com/libgdx/libgdx/wiki/Managing-your-assets

                  video on YouTUBE https://www.youtube.com/watch?v=JXThbQir2gU

                  other example in GitHub https://github.com/Matsemann/libgdx-loading-screen

                  NEW look this:

                  Proper way to dispose screens in Libgdx

                  What's the right place to dispose a libgdx Screen

                  It can help you decide if you need to call dipose, and how, I hope it will help.

                  这篇关于如果在启动画面打开时中断游戏崩溃 - LIBGDX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:“signInSilently(): 失败"尝试使用 LibGDX 登录 G 下一篇:在 LibGDX 中保存和检索图像文件

                  相关文章

                  最新文章

                  • <bdo id='UWI8R'></bdo><ul id='UWI8R'></ul>

                    <tfoot id='UWI8R'></tfoot>
                    <legend id='UWI8R'><style id='UWI8R'><dir id='UWI8R'><q id='UWI8R'></q></dir></style></legend>
                    <i id='UWI8R'><tr id='UWI8R'><dt id='UWI8R'><q id='UWI8R'><span id='UWI8R'><b id='UWI8R'><form id='UWI8R'><ins id='UWI8R'></ins><ul id='UWI8R'></ul><sub id='UWI8R'></sub></form><legend id='UWI8R'></legend><bdo id='UWI8R'><pre id='UWI8R'><center id='UWI8R'></center></pre></bdo></b><th id='UWI8R'></th></span></q></dt></tr></i><div id='UWI8R'><tfoot id='UWI8R'></tfoot><dl id='UWI8R'><fieldset id='UWI8R'></fieldset></dl></div>
                    1. <small id='UWI8R'></small><noframes id='UWI8R'>