File Extensions.cs
File List > LemonUI > LemonUI > Tools > Extensions.cs
Go to the documentation of this file
using System.Drawing;
namespace LemonUI.Tools
{
public static class Extensions
{
#region Float
public static float ToXRelative(this float x) => x / (1080f * GameScreen.AspectRatio);
public static float ToYRelative(this float y) => y / 1080f;
public static float ToXScaled(this float x) => (1080f * GameScreen.AspectRatio) * x;
public static float ToYScaled(this float y) => 1080f * y;
#endregion
#region PointF
public static PointF ToRelative(this PointF point) => new PointF(point.X.ToXRelative(), point.Y.ToYRelative());
public static PointF ToScaled(this PointF point) => new PointF(point.X.ToXScaled(), point.Y.ToYScaled());
#endregion
#region SizeF
public static SizeF ToRelative(this SizeF size) => new SizeF(size.Width.ToXRelative(), size.Height.ToYRelative());
public static SizeF ToScaled(this SizeF size) => new SizeF(size.Width.ToXScaled(), size.Height.ToYScaled());
#endregion
}
}