Status of the Loading the TextureAtlas

2020-05-01 08:12发布

I am using the TextureAtlas in my LibGdx based game. As the size of the Atlas increases the loading time increases hence there is a delay in showing the animations that I have setup in the game.

Hence I wish to get the status of the loading process of my TextureAtlas. 1. Anyway to get the status ? 2. Any Listener ?

1条回答
Juvenile、少年°
2楼-- · 2020-05-01 08:25

You can take for example, asset that have been loaded with this method, yourAssetManage.getLoadedAssets () this method return an int indicating the number of loaded assets

    Gdx.app.log("asset loaded :", ""+yourAssetManger.getLoadedAssets());

    if (yourAssetManger.update()) {

         if (Gdx.input.isTouched()) { 
            yourGame.setScreen(new yourScreen());
        }
    }

or isLoaded(String fileName); http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/AssetManager.html#isLoaded-java.lang.String-

yourAssetManage.isLoaded("fileNameOfYourAsset");
查看更多
登录 后发表回答