Rect2 Structure |
Namespace: Godot
[SerializableAttribute] public struct Rect2 : IEquatable<Rect2>
The Rect2 type exposes the following members.
| Name | Description | |
|---|---|---|
| Rect2(Vector2, Vector2) |
Constructs a Rect2 from a position and size.
| |
| Rect2(Single, Single, Vector2) |
Constructs a Rect2 from x, y, and size.
| |
| Rect2(Vector2, Single, Single) |
Constructs a Rect2 from a position, width, and height.
| |
| Rect2(Single, Single, Single, Single) |
Constructs a Rect2 from x, y, width, and height.
|
| Name | Description | |
|---|---|---|
| Area |
The area of this rect.
| |
| End | ||
| Position |
Beginning corner. Typically has values lower than End.
| |
| Size |
Size from Position to End. Typically all components are positive.
If the size is negative, you can use Abs to fix it.
|
| Name | Description | |
|---|---|---|
| Abs |
Returns a Rect2 with equivalent position and size, modified so that
the top-left corner is the origin and width and height are positive.
| |
| Clip |
Returns the intersection of this Rect2 and `b`.
| |
| Encloses |
Returns true if this Rect2 completely encloses another one.
| |
| Equals(Object) | (Overrides ValueTypeEquals(Object).) | |
| Equals(Rect2) | ||
| Expand |
Returns this Rect2 expanded to include a given point.
| |
| GetArea |
Returns the area of the Rect2.
| |
| GetHashCode | (Overrides ValueTypeGetHashCode.) | |
| GetType | (Inherited from Object.) | |
| Grow |
Returns a copy of the Rect2 grown a given amount of units towards all the sides.
| |
| GrowIndividual |
Returns a copy of the Rect2 grown a given amount of units towards each direction individually.
| |
| GrowMargin |
Returns a copy of the Rect2 grown a given amount of units towards the Margin direction.
| |
| HasNoArea |
Returns true if the Rect2 is flat or empty, or false otherwise.
| |
| HasPoint |
Returns true if the Rect2 contains a point, or false otherwise.
| |
| Intersects |
Returns true if the Rect2 overlaps with `b`
(i.e. they have at least one point in common).
If `includeBorders` is true, they will also be considered overlapping
if their borders touch, even without intersection.
| |
| IsEqualApprox |
Returns true if this rect and `other` are approximately equal, by running
IsEqualApprox(Vector2) on each component.
| |
| Merge |
Returns a larger Rect2 that contains this Rect2 and `b`.
| |
| ToString | (Overrides ValueTypeToString.) | |
| ToString(String) |
| Name | Description | |
|---|---|---|
| Equality | ||
| Inequality |