Added convenience function for UI modules that centers the origin relative to the bounds.

This commit is contained in:
Harrison Deng 2019-01-27 18:06:55 -06:00
parent 66b2fb9c5c
commit fa8a8f169c

View File

@ -78,10 +78,7 @@ namespace RecrownedAthenaeum.UI.Modular
/// </summary>
public void RemoveFromParent()
{
if (Parent == null)
{
throw new InvalidOperationException("Parent is null.");
}
if (Parent == null) throw new InvalidOperationException("Parent is null.");
Parent.RemoveModule(this);
}
@ -104,5 +101,14 @@ namespace RecrownedAthenaeum.UI.Modular
{
return true;
}
/// <summary>
/// Sets the origin to be the center of the bounds.
/// </summary>
public void CenterOrigin()
{
origin.X = bounds.Width / 2f;
origin.Y = bounds.Height / 2f;
}
}
}