Roblox-File-Format/DataTypes/Rect.cs
CloneTrooper1019 e14b092aa7 Added read support for Instance Attributes.
This isn't 100% finished yet. I intend to add some better API for reading specific attributes, as well as write support (of course!)
2019-10-31 21:40:31 -05:00

32 lines
769 B
C#

namespace RobloxFiles.DataTypes
{
public class Rect
{
public readonly Vector2 Min;
public readonly Vector2 Max;
public float Width => (Max - Min).X;
public float Height => (Max - Min).Y;
public override string ToString() => $"{Min}, {Max}";
public Rect(Vector2 min = null, Vector2 max = null)
{
Min = min ?? Vector2.Zero;
Max = max ?? Vector2.Zero;
}
public Rect(float minX, float minY, float maxX, float maxY)
{
Min = new Vector2(minX, minY);
Max = new Vector2(maxX, maxY);
}
internal Rect(Attribute attr)
{
Min = new Vector2(attr);
Max = new Vector2(attr);
}
}
}