December 14, 2025

Libgdx Texture Packer Now

Write a simple Java class or Gradle task to run the packer:

import com.badlogic.gdx.tools.texturepacker.TexturePacker; public class AssetPacker public static void main(String[] args) TexturePacker.Settings settings = new TexturePacker.Settings(); settings.pot = true; settings.paddingX = 2; settings.paddingY = 2; settings.edgePadding = true; settings.stripWhitespace = true; settings.filterMin = TexturePacker.Settings.TextureFilter.Nearest; settings.filterMag = TexturePacker.Settings.TextureFilter.Nearest; libgdx texture packer

Run this main method every time you change your assets. Once you have player.atlas and player.png in your assets folder, load and use them: Write a simple Java class or Gradle task

// (input directory, output directory, atlas file name) TexturePacker.process(settings, "raw-assets/player", "android/assets/", "player"); Get a single region (a sprite from the

// 1. Load the atlas TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("player.atlas")); // 2. Get a single region (a sprite from the atlas) TextureRegion playerStand = atlas.findRegion("player_idle_01");

raw-assets/player/ ├── idle/ │ ├── frame1.png │ └── frame2.png └── run/ ├── run01.png └── run02.png You can access atlas.findRegion("idle/frame1") or atlas.findRegions("run") .

// 3. Or get an animated region Animation<TextureRegion> walkAnimation = new Animation<>(0.1f, atlas.findRegions("player_walk"), Animation.PlayMode.LOOP);

Shopping cart0
There are no products in the cart!
Continue shopping
0