Appearance
MonoGame.Extended exporter
Output
Each atlas page has a separate TexturePacker-compatible JSON descriptor and image:
text
atlas.json atlas_texture.pngThe JSON and image form one Texture2DAtlas content asset.
Integrate
Add every JSON descriptor and matching image to the MonoGame Content project. Load each JSON descriptor as a Texture2DAtlas, then create a native sprite by frame name:
csharp
var atlas = Content.Load<Texture2DAtlas>("atlas");
var sprite = atlas.CreateSprite("player_0001");Draw the Sprite with MonoGame.Extended's normal SpriteBatch integration. Keep the generated region names unchanged; animation indices are zero-padded to make name-based lookup stable.
Minimal game
This assumes atlas.json and atlas_texture.png are added to the Content project and the MonoGame.Extended content reader is installed. Replace player_0001 with a frame name that exists in your atlas:
csharp
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Extended.Graphics;
public sealed class DemoGame : Game
{
private readonly GraphicsDeviceManager graphics;
private SpriteBatch batch = null!;
private Sprite sprite = null!;
public DemoGame() { graphics = new GraphicsDeviceManager(this); }
protected override void LoadContent()
{
batch = new SpriteBatch(GraphicsDevice);
var atlas = Content.Load<Texture2DAtlas>("atlas");
sprite = atlas.CreateSprite("player_0001");
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
batch.Begin();
batch.Draw(sprite, new Vector2(400, 300), 0f, Vector2.One);
batch.End();
base.Draw(gameTime);
}
}
public static class Program
{
public static void Main() { using var game = new DemoGame(); game.Run(); }
}