GDX Texture Packer
Make sure you have Java installed.
Open CMD where you have downloaded the gdx-texturepacker.jar.
Program is opened.
Prepare your images. Eg. Create a folder containing few images. Mine are three 64×64 png with alpha (32bit).
In program create “New pack”, name it, eg. “mycogs”.
Browse “Input directory”, eg. “C:\Users\Roman\Pictures\cogs”. Same for “Output directory”.
Press “Pack’em all”. Console shows up showing progress. And Done!
2 files are generated in output directory: “mycogs.png” the tileset/atlas with all images and “mycogs.pack” the text file with description which image is where, etc.
Now, lets use them in our libGDX project. Move those two files to your project folder.
import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; TextureAtlas ta = new TextureAtlas("mycogs.pack"); AtlasRegion cogTex = ta.findRegion("cog_red"); AtlasRegion cogNTex = ta.findRegion("cog_white"); AtlasRegion cogSTex = ta.findRegion("cog_grey");