Refactors and documentation.

This commit is contained in:
2019-01-15 17:03:17 -06:00
parent f5cbd9dbab
commit a62ec1bd38
8 changed files with 108 additions and 20 deletions

View File

@@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\RecrownedAthenaeum.Pipeline.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>

View File

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