Struct Rect
Represents a rectangle defined by its position and size.
public struct Rect
- Inherited Members
Constructors
Rect()
Initializes a new instance of the Rect struct with default values.
public Rect()
Rect(float, float, float, float)
Initializes a new instance of the Rect struct with specified position and size.
public Rect(float x, float y, float width, float height)
Parameters
Properties
Height
The height of the rectangle.
public float Height { readonly get; set; }
Property Value
Width
The width of the rectangle.
public float Width { readonly get; set; }
Property Value
X
The X coordinate of the rectangle's position.
public float X { readonly get; set; }
Property Value
Y
The Y coordinate of the rectangle's position.
public float Y { readonly get; set; }
Property Value
Methods
Contains(Vector2)
Checks if the rectangle contains a point defined by a Vector2.
public bool Contains(Vector2 vector2)
Parameters
vector2Vector2
Returns
Contains(float, float)
Checks if the rectangle contains a point defined by its X and Y coordinates.
public bool Contains(float x, float y)
Parameters
Returns
Intersects(Rect)
Checks if the rectangle intersects with another rectangle.
public bool Intersects(Rect other)
Parameters
otherRect