using Microsoft.Xna.Framework; namespace RecrownedAthenaeum.Data { /// /// 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 struct AtlasRegionData { /// /// Name of the region for referencial purposes. /// public string name; /// /// The location of the patch is designated by this rectangle. /// public Rectangle bounds; /// /// 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) { bounds.X = x; bounds.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) { bounds.Width = width; bounds.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); } } } }