【发布时间】:2013-09-21 13:01:16
【问题描述】:
我正在使用 TextureAtlas 在 Libgdx 中加载我的游戏资源。我知道TextureAtlas 的方法findRegion 是昂贵的,内存明智的,所以它应该加载一次并存储。
我刚刚在Skin 类中遇到了这个例子:
TextureAtlas atlas = ...
Skin skin = new Skin();
skin.addRegions(atlas);
...
TextureRegion hero = skin.get("hero", TextureRegion.class);
这意味着我也可以使用 Skin 来获取我的纹理。我的问题是,Skin 类如何加载这些资产。它会在skin.addRegions(atlas); 上加载所有内容吗?还是 skin.get("hero", TextureRegion.class); 在每次调用时从 TextureAtlas 加载它,使其与 atlas.findRegion("hero") 调用一样昂贵?
我希望在游戏开始时从 TextureAtlas 加载我的所有资源。所以我在想我可以在皮肤中做一个简单的加载,然后从那里使用我的资产吗?
【问题讨论】:
标签: memory libgdx assets texture-atlas