I have some code which will detect the start and end point of a click-and-drag action, and will save it to 2 vector2 points. I then use this code to convert:
public Rectangle toRect(Vector2 a, Vector2 b)
{
return new Rectangle((int)a.X, (int)a.Y, (int)(b.X - a.X), (int)(b.Y - a.Y));
}
The code above does not work and googling, so far has come up inconclusive.
Could anyone please provide me with some code or a formula to properly convert this?
Note: a vector2 has an x and a y, and a rectangle has an x, a y, a width, and a height.
Any help is appreciated! Thanks