该TextureAtlas的加载状态

该TextureAtlas的加载状态

本文介绍了该TextureAtlas的加载状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是用我的LibGdx的游戏的TextureAtlas。作为阿特拉斯的尺寸增加了装载时间的增加,因此有在表明我已经安装在游戏中动画的延迟。

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.

因此​​,我希望得到我的TextureAtlas加载过程的状态。1.反正拿到状态?2.任何监听器?

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

推荐答案

您可以举个例子,已用此方法加载的资产, yourAssetManage.getLoadedAssets()这个方法返回一个 INT 表示加载资源的数量

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());
        }
    }

或isLoaded(字符串文件名); http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/AssetManager.html#isLoaded-java.lang.String-

yourAssetManage.isLoaded("fileNameOfYourAsset");

这篇关于该TextureAtlas的加载状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 15:12