public GetApsoluteMouse ( int X, int Y ) : System.Vector2 | ||
X | int | |
Y | int | |
return | System.Vector2 |
public Vector2 GetApsoluteMouse(int X, int Y)
{
float x, y;
x = X;
y = Y;
x -= Firefly.Window.Width/2;
y -= Firefly.Window.Height/2;
x /= zoom;
y /= zoom;
var angle = (float) Math.Atan2(y, x);
angle -= rotation;
var distance = (float) Math.Sqrt(x*x + y*y);
x = (float) Math.Cos(angle)*distance;
y = (float) Math.Sin(angle)*distance;
x -= this.x;
y -= this.y;
return new Vector2(x, y);
}