Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ClosestPointInRect()

static Vector2 Terraria.Utils.ClosestPointInRect ( this Rectangle r,
Vector2 point )
inlinestatic

Definition at line 1045 of file Utils.cs.

1046 {
1047 Vector2 result = point;
1048 if (result.X < (float)r.Left)
1049 {
1050 result.X = r.Left;
1051 }
1052 if (result.X > (float)r.Right)
1053 {
1054 result.X = r.Right;
1055 }
1056 if (result.Y < (float)r.Top)
1057 {
1058 result.Y = r.Top;
1059 }
1060 if (result.Y > (float)r.Bottom)
1061 {
1062 result.Y = r.Bottom;
1063 }
1064 return result;
1065 }

References Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.