Some renamings

This commit is contained in:
Absolutely disgusting
2025-10-29 17:26:09 +04:00
parent c5632629a5
commit 67543bea12
6 changed files with 10 additions and 10 deletions

View File

@@ -0,0 +1,46 @@
namespace _2DGAMELIB
{
public class Rectangle
{
public double XRatio = 1.0;
public double YRatio = 1.0;
public double Size = 1.0;
public double LocalWidth => XRatio * Size;
public double LocalHeight => YRatio * Size;
public Vector2D LocalCenter => new Vector2D(LocalWidth * 0.5, LocalHeight * 0.5);
public Rectangle(){}
public Rectangle(double XRatio, double YRatio, double Size)
{
SetXYRatio(XRatio, YRatio);
this.Size = Size;
}
public void SetXYRatio(double X, double Y)
{
XRatio = X / Y;
YRatio = 1.0;
}
public Vector2D GetPosition(double X, double Y)
{
return new Vector2D(LocalWidth * X, LocalHeight * Y);
}
public Vector2D GetPosition(Vector2D p)
{
return new Vector2D(LocalWidth * p.X, LocalHeight * p.Y);
}
public Vector2D GetPosition(ref Vector2D p)
{
return new Vector2D(LocalWidth * p.X, LocalHeight * p.Y);
}
}
}