Skip to content

Commit

Permalink
Adds Vector2 Overloads For FloatRect and IntRect
Browse files Browse the repository at this point in the history
  • Loading branch information
charleyah authored and eXpl0it3r committed May 27, 2024
1 parent f49b3ee commit 857906a
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions src/SFML.Graphics/Rect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,45 @@ public bool Contains(int x, int y)
return ( x >= minX ) && ( x < maxX ) && ( y >= minY ) && ( y < maxY );
}


////////////////////////////////////////////////////////////
/// <summary>
/// Check if a point is inside the rectangle's area
/// </summary>
/// <param name="point">Vector2 position of the point to test</param>
/// <returns>True if the point is inside</returns>
////////////////////////////////////////////////////////////
public bool Contains(Vector2i point)
{
return Contains(point.X, point.Y);
}


////////////////////////////////////////////////////////////
/// <summary>
/// Check if a point is inside the rectangle's area
/// </summary>
/// <param name="point">Vector2 position of the point to test</param>
/// <returns>True if the point is inside</returns>
////////////////////////////////////////////////////////////
public bool Contains(Vector2u point)
{
return Contains((Vector2i)point);
}


////////////////////////////////////////////////////////////
/// <summary>
/// Check if a point is inside the rectangle's area
/// </summary>
/// <param name="point">Vector2 position of the point to test</param>
/// <returns>True if the point is inside</returns>
////////////////////////////////////////////////////////////
public bool Contains(Vector2f point)
{
return Contains((Vector2i)point);
}

////////////////////////////////////////////////////////////
/// <summary>
/// Check intersection between two rectangles
Expand Down Expand Up @@ -291,6 +330,43 @@ public bool Contains(float x, float y)
return ( x >= minX ) && ( x < maxX ) && ( y >= minY ) && ( y < maxY );
}

////////////////////////////////////////////////////////////
/// <summary>
/// Check if a point is inside the rectangle's area
/// </summary>
/// <param name="point">Vector2 position of the point to test</param>
/// <returns>True if the point is inside</returns>
////////////////////////////////////////////////////////////
public bool Contains(Vector2f point)
{
return Contains(point.X, point.Y);
}

////////////////////////////////////////////////////////////
/// <summary>
/// Check if a point is inside the rectangle's area
/// </summary>
/// <param name="point">Vector2 position of the point to test</param>
/// <returns>True if the point is inside</returns>
////////////////////////////////////////////////////////////
public bool Contains(Vector2i point)
{
return Contains((Vector2f)point);
}


////////////////////////////////////////////////////////////
/// <summary>
/// Check if a point is inside the rectangle's area
/// </summary>
/// <param name="point">Vector2 position of the point to test</param>
/// <returns>True if the point is inside</returns>
////////////////////////////////////////////////////////////
public bool Contains(Vector2u point)
{
return Contains((Vector2f)point);
}

////////////////////////////////////////////////////////////
/// <summary>
/// Check intersection between two rectangles
Expand Down

0 comments on commit 857906a

Please sign in to comment.