Libgdx | How to create a splash screen? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Libgdx | How to create a splash screen? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am wondering what the best way to create a splash screen is (When you start game, the companies logo animated). I have create a .mp4 splash screen in after effects, but can’t find a way to display it in libgdx. What’s the best way to create a splash screen? Can you use an .mp4 file and play it or not?


I have to say the accepted answer by @AkashBhave is a very strange way of making a splash screen, and probably should not be accepted as the “best” way to do it. The purpose of a splash screen is to temporarily display something while the game or app loads in the background. If you have a lot of assets to load, you could be looking at up to 10 seconds to prepare the app on slow devices. The accepted answer says absolutely nothing about asynchronously loading assets, and given that there is just a simple counter before continuing to the “game code”, one can assume that this splash screen would only be shown after everything has already loaded, otherwise there would be no guarantee the assets are loaded and it would just crash if not.

Personally I think the “best” way to make a splash screen is to make it display as fast as possible, preferably less than a second when one clicks on the app to open it. The way to do this would be to use the AssetManager to load only the Assets you need to display your splash screen. Then, while your splash screen is displaying/animating, you tell AssetManager to load the rest of your core components. Once it is finished, you proceed to your main app.

I posted an answer with a bit more details related to this here, and there is a pretty good in-depth guide on the AssetManager on the libGDX Wiki.

So, the key here is assetManager.update(), this does 2 things. 1, it tells the AssetManager to load the queue of .load() items, and 2, it returns true if it has finished. Therefore if you also want to ensure your splash screen has displayed for a certain amount of time, you would do something like this;

public void render(float delta){
    //code to render splash here

    //check if assets are loaded and time greater than 10 seconds
    if(assetManager.update() && TimeUtils.timeSinceMillis(startTime) > 10000){
        app.setScreen(new MainScreen());

Or, if you do have a libGDX Animation, you would do something like;

 if(assetManager.update() && animation.isAnimationFinished(startTime)){..}
We are here to answer your question about Libgdx | How to create a splash screen? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji