Reading the Exported XML - Godofdrakes/Sprite-Packer GitHub Wiki

Getting the information you need

Getting the list of images to load
Each Animation node contains the attribute "FileName" which corresponds to that animation's image file.
Getting the UV data for part of an image
Each Animation node contains the sub-node "Size" with attributes the width and height of it's image file.
Each Image node contains the sub-nodes "Size" and "Position".
double top = (double)Image.Position.Y / (double)Animation.Size.Height;
double left = (double)Image.Position.X / (double)Animation.Size.Width;
double bottom = ( (double)Image.Position.Y + (double)Image.Size.Height ) / (double)Animation.Size.Height;
double right = ( (double)Image.Position.X + (double)Image.Size.Width) / (double)Animation.Size.Width;

Example of exported XML

<?xml version="1.0" encoding="utf-8"?>
<SpriteSheet Count="3">
  <Animation Name="Animation" Count="3" FileName="test_0.png">
    <Image Name="Sprite_Packer.SpriteImage">
      <Size Width="32" Height="32" />
      <Position X="5" Y="5" />
    </Image>
    <Image Name="Sprite_Packer.SpriteImage">
      <Size Width="32" Height="32" />
      <Position X="42" Y="5" />
    </Image>
    <Image Name="Sprite_Packer.SpriteImage">
      <Size Width="32" Height="32" />
      <Position X="79" Y="5" />
    </Image>
    <Size Width="116" Height="42" />
  </Animation>
  <Animation Name="Animation" Count="2" FileName="test_1.png">
    <Image Name="Sprite_Packer.SpriteImage">
      <Size Width="32" Height="32" />
      <Position X="5" Y="5" />
    </Image>
    <Image Name="Sprite_Packer.SpriteImage">
      <Size Width="32" Height="32" />
      <Position X="42" Y="5" />
    </Image>
    <Size Width="79" Height="42" />
  </Animation>
  <Animation Name="Animation" Count="1" FileName="test_2.png">
    <Image Name="Sprite_Packer.SpriteImage">
      <Size Width="32" Height="32" />
      <Position X="5" Y="5" />
    </Image>
    <Size Width="42" Height="42" />
  </Animation>
</SpriteSheet>
⚠️ **GitHub.com Fallback** ⚠️