Jan Lovšin Jan Lovšin - 4 months ago 12
Android Question

How to obtain a "loading screen" using libgdx?

I have been wondering how to create a loading screen. If I use

while (!manager.update())


the game will never render. Then I had an idea if I would call in the while loop manually the render method. Like:

while (!manager.update())
render();


it would probably work. Then I could also just create another thread and render in besides this thread? What is the best solution?

Answer

You really should take a look at this wiki page, your render method should be something like this:

 public void render() {
      if(manager.update()) {
         // we are done loading, let's move to another screen!
      }

      // display loading information
      float progress = manager.getProgress()
      ... left to the reader ...
   }