加载 TextureAtlas 的状态 [英] Status of the Loading the TextureAtlas

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

问题描述

我在基于 LibGdx 的游戏中使用 TextureAtlas.随着 Atlas 大小的增加,加载时间也会增加,因此在显示我在游戏中设置的动画时会出现延迟.

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 ?

推荐答案

可以举个例子,用这个方法加载的asset,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());
        }
    }

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

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

yourAssetManage.isLoaded("fileNameOfYourAsset");

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆