using Microsoft.Xna.Framework;
using RecrownedAthenaeum.Pipeline.NinePatch;
namespace RecrownedAthenaeum.Pipeline.TextureAtlas
{
///
/// Data transfer object for a texture atlas.
///
public class TextureAtlasData
{
///
/// Contains the regions of the texture atlas.
///
public AtlasRegionData[] regions;
///
/// The name of the file.
///
public string textureName;
///
/// Creates the atlas given the regions and the file name of the texture file to be used.
///
///
///
public TextureAtlasData(string textureName, AtlasRegionData[] regions)
{
this.regions = regions;
this.textureName = textureName;
}
///
/// Data object that contains information about the region ninepatch situation of a given region in an atlas.
///
public class AtlasRegionData
{
///
/// Name of the region for referencial purposes.
///
public string name;
///
/// The location of the patch is designated by this rectangle.
///
public Rectangle location;
///
/// The ninepatch information.
///
public NinePatchData ninePatchData;
///
/// Sets position in atlas for convenience.
///
/// X coordinate of the position in the patch.
/// Y coordinate of the position in the patch.
public void SetPosition(int x, int y)
{
location.X = x;
location.Y = y;
}
///
/// Sets the dimensions of the region on the atlas for convenience.
///
/// Width of the region.
/// Height of the region.
public void SetSize(int width, int height)
{
location.Width = width;
location.Height = height;
}
///
/// Sets both the coordinates and dimensions of the region on the atlas for convenience.
///
/// X coordinate of the position in the patch.
/// Y coordinate of the position in the patch.
/// Width of the region.
/// Height of the region.
public void SetBounds(int x, int y, int width, int height)
{
SetPosition(x, y);
SetSize(width, height);
}
}
}
}