libgdx中利用打包工具TexturePacker打包游戏图片节约内存

下面我介绍一下我做游戏使用的图片打包工具吧。TexturePacker----它几乎可以支持所有2d游戏引擎以及部分3d游戏引擎。

1.我们打开软件->


2.择需要打包的格式->

3.添加图片->


4.调整参数->

5.发布(publish)


6.在libgdx中使用

mAssetManager = new AssetManager();
		mAssetManager.load(Assert.MENUUI, TextureAtlas.class);
		mAssetManager.load(Assert.SOUND1, Sound.class);
		mAssetManager.load(Assert.SOUND2, Sound.class);
		mAssetManager.load(Assert.SOUND3, Sound.class);
		mAssetManager.load(Assert.DROP, Sound.class);
		mAssetManager.finishLoading();

mAtlas = mAssetManager.get(Assert.MENUUI, TextureAtlas.class);

使用的时候:

mControlRegion = mAtlas.findRegion("control_level");

注意在libgdx中打包进去的图片是不用输入图片后缀名的!!!

7.软件地址:

原文地址:https://www.cnblogs.com/tqj-zyy/p/4559757.html