|
@@ -52,7 +52,7 @@ namespace Godot
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// The area of this rect.
|
|
|
|
|
|
+ /// The area of this Rect2.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>Equivalent to <see cref="GetArea()"/>.</value>
|
|
/// <value>Equivalent to <see cref="GetArea()"/>.</value>
|
|
public real_t Area
|
|
public real_t Area
|
|
@@ -64,7 +64,7 @@ namespace Godot
|
|
/// Returns a Rect2 with equivalent position and size, modified so that
|
|
/// Returns a Rect2 with equivalent position and size, modified so that
|
|
/// the top-left corner is the origin and width and height are positive.
|
|
/// the top-left corner is the origin and width and height are positive.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <returns>The modified rect.</returns>
|
|
|
|
|
|
+ /// <returns>The modified Rect2.</returns>
|
|
public Rect2 Abs()
|
|
public Rect2 Abs()
|
|
{
|
|
{
|
|
Vector2 end = End;
|
|
Vector2 end = End;
|
|
@@ -76,8 +76,8 @@ namespace Godot
|
|
/// Returns the intersection of this Rect2 and `b`.
|
|
/// Returns the intersection of this Rect2 and `b`.
|
|
/// If the rectangles do not intersect, an empty Rect2 is returned.
|
|
/// If the rectangles do not intersect, an empty Rect2 is returned.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="b">The other rect.</param>
|
|
|
|
- /// <returns>The intersection of this Rect2 and `b`, or an empty rect if they do not intersect.</returns>
|
|
|
|
|
|
+ /// <param name="b">The other Rect2.</param>
|
|
|
|
+ /// <returns>The intersection of this Rect2 and `b`, or an empty Rect2 if they do not intersect.</returns>
|
|
public Rect2 Intersection(Rect2 b)
|
|
public Rect2 Intersection(Rect2 b)
|
|
{
|
|
{
|
|
var newRect = b;
|
|
var newRect = b;
|
|
@@ -102,8 +102,8 @@ namespace Godot
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Returns true if this Rect2 completely encloses another one.
|
|
/// Returns true if this Rect2 completely encloses another one.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="b">The other rect that may be enclosed.</param>
|
|
|
|
- /// <returns>A bool for whether or not this rect encloses `b`.</returns>
|
|
|
|
|
|
+ /// <param name="b">The other Rect2 that may be enclosed.</param>
|
|
|
|
+ /// <returns>A bool for whether or not this Rect2 encloses `b`.</returns>
|
|
public bool Encloses(Rect2 b)
|
|
public bool Encloses(Rect2 b)
|
|
{
|
|
{
|
|
return b._position.x >= _position.x && b._position.y >= _position.y &&
|
|
return b._position.x >= _position.x && b._position.y >= _position.y &&
|
|
@@ -115,7 +115,7 @@ namespace Godot
|
|
/// Returns this Rect2 expanded to include a given point.
|
|
/// Returns this Rect2 expanded to include a given point.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="to">The point to include.</param>
|
|
/// <param name="to">The point to include.</param>
|
|
- /// <returns>The expanded rect.</returns>
|
|
|
|
|
|
+ /// <returns>The expanded Rect2.</returns>
|
|
public Rect2 Expand(Vector2 to)
|
|
public Rect2 Expand(Vector2 to)
|
|
{
|
|
{
|
|
var expanded = this;
|
|
var expanded = this;
|
|
@@ -157,10 +157,10 @@ namespace Godot
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// Returns a copy of the Rect2 grown a given amount of units towards all the sides.
|
|
|
|
|
|
+ /// Returns a copy of the Rect2 grown by the specified amount on all sides.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="by">The amount to grow by.</param>
|
|
/// <param name="by">The amount to grow by.</param>
|
|
- /// <returns>The grown rect.</returns>
|
|
|
|
|
|
+ /// <returns>The grown Rect2.</returns>
|
|
public Rect2 Grow(real_t by)
|
|
public Rect2 Grow(real_t by)
|
|
{
|
|
{
|
|
var g = this;
|
|
var g = this;
|
|
@@ -174,13 +174,13 @@ namespace Godot
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// Returns a copy of the Rect2 grown a given amount of units towards each direction individually.
|
|
|
|
|
|
+ /// Returns a copy of the Rect2 grown by the specified amount on each side individually.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="left">The amount to grow by on the left.</param>
|
|
|
|
- /// <param name="top">The amount to grow by on the top.</param>
|
|
|
|
- /// <param name="right">The amount to grow by on the right.</param>
|
|
|
|
- /// <param name="bottom">The amount to grow by on the bottom.</param>
|
|
|
|
- /// <returns>The grown rect.</returns>
|
|
|
|
|
|
+ /// <param name="left">The amount to grow by on the left side.</param>
|
|
|
|
+ /// <param name="top">The amount to grow by on the top side.</param>
|
|
|
|
+ /// <param name="right">The amount to grow by on the right side.</param>
|
|
|
|
+ /// <param name="bottom">The amount to grow by on the bottom side.</param>
|
|
|
|
+ /// <returns>The grown Rect2.</returns>
|
|
public Rect2 GrowIndividual(real_t left, real_t top, real_t right, real_t bottom)
|
|
public Rect2 GrowIndividual(real_t left, real_t top, real_t right, real_t bottom)
|
|
{
|
|
{
|
|
var g = this;
|
|
var g = this;
|
|
@@ -194,19 +194,19 @@ namespace Godot
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// Returns a copy of the Rect2 grown a given amount of units towards the <see cref="Margin"/> direction.
|
|
|
|
|
|
+ /// Returns a copy of the Rect2 grown by the specified amount on the specified Side.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="margin">The direction to grow in.</param>
|
|
|
|
|
|
+ /// <param name="side">The side to grow.</param>
|
|
/// <param name="by">The amount to grow by.</param>
|
|
/// <param name="by">The amount to grow by.</param>
|
|
- /// <returns>The grown rect.</returns>
|
|
|
|
- public Rect2 GrowMargin(Margin margin, real_t by)
|
|
|
|
|
|
+ /// <returns>The grown Rect2.</returns>
|
|
|
|
+ public Rect2 GrowSide(Side side, real_t by)
|
|
{
|
|
{
|
|
var g = this;
|
|
var g = this;
|
|
|
|
|
|
- g = g.GrowIndividual(Margin.Left == margin ? by : 0,
|
|
|
|
- Margin.Top == margin ? by : 0,
|
|
|
|
- Margin.Right == margin ? by : 0,
|
|
|
|
- Margin.Bottom == margin ? by : 0);
|
|
|
|
|
|
+ g = g.GrowIndividual(Side.Left == side ? by : 0,
|
|
|
|
+ Side.Top == side ? by : 0,
|
|
|
|
+ Side.Right == side ? by : 0,
|
|
|
|
+ Side.Bottom == side ? by : 0);
|
|
|
|
|
|
return g;
|
|
return g;
|
|
}
|
|
}
|
|
@@ -214,7 +214,7 @@ namespace Godot
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Returns true if the Rect2 is flat or empty, or false otherwise.
|
|
/// Returns true if the Rect2 is flat or empty, or false otherwise.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <returns>A bool for whether or not the rect has area.</returns>
|
|
|
|
|
|
+ /// <returns>A bool for whether or not the Rect2 has area.</returns>
|
|
public bool HasNoArea()
|
|
public bool HasNoArea()
|
|
{
|
|
{
|
|
return _size.x <= 0 || _size.y <= 0;
|
|
return _size.x <= 0 || _size.y <= 0;
|
|
@@ -224,7 +224,7 @@ namespace Godot
|
|
/// Returns true if the Rect2 contains a point, or false otherwise.
|
|
/// Returns true if the Rect2 contains a point, or false otherwise.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="point">The point to check.</param>
|
|
/// <param name="point">The point to check.</param>
|
|
- /// <returns>A bool for whether or not the rect contains `point`.</returns>
|
|
|
|
|
|
+ /// <returns>A bool for whether or not the Rect2 contains `point`.</returns>
|
|
public bool HasPoint(Vector2 point)
|
|
public bool HasPoint(Vector2 point)
|
|
{
|
|
{
|
|
if (point.x < _position.x)
|
|
if (point.x < _position.x)
|
|
@@ -247,7 +247,7 @@ namespace Godot
|
|
/// If `includeBorders` is true, they will also be considered overlapping
|
|
/// If `includeBorders` is true, they will also be considered overlapping
|
|
/// if their borders touch, even without intersection.
|
|
/// if their borders touch, even without intersection.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="b">The other rect to check for intersections with.</param>
|
|
|
|
|
|
+ /// <param name="b">The other Rect2 to check for intersections with.</param>
|
|
/// <param name="includeBorders">Whether or not to consider borders.</param>
|
|
/// <param name="includeBorders">Whether or not to consider borders.</param>
|
|
/// <returns>A bool for whether or not they are intersecting.</returns>
|
|
/// <returns>A bool for whether or not they are intersecting.</returns>
|
|
public bool Intersects(Rect2 b, bool includeBorders = false)
|
|
public bool Intersects(Rect2 b, bool includeBorders = false)
|
|
@@ -297,8 +297,8 @@ namespace Godot
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Returns a larger Rect2 that contains this Rect2 and `b`.
|
|
/// Returns a larger Rect2 that contains this Rect2 and `b`.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="b">The other rect.</param>
|
|
|
|
- /// <returns>The merged rect.</returns>
|
|
|
|
|
|
+ /// <param name="b">The other Rect2.</param>
|
|
|
|
+ /// <returns>The merged Rect2.</returns>
|
|
public Rect2 Merge(Rect2 b)
|
|
public Rect2 Merge(Rect2 b)
|
|
{
|
|
{
|
|
Rect2 newRect;
|
|
Rect2 newRect;
|
|
@@ -388,11 +388,11 @@ namespace Godot
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// Returns true if this rect and `other` are approximately equal, by running
|
|
|
|
|
|
+ /// Returns true if this Rect2 and `other` are approximately equal, by running
|
|
/// <see cref="Vector2.IsEqualApprox(Vector2)"/> on each component.
|
|
/// <see cref="Vector2.IsEqualApprox(Vector2)"/> on each component.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="other">The other rect to compare.</param>
|
|
|
|
- /// <returns>Whether or not the rects are approximately equal.</returns>
|
|
|
|
|
|
+ /// <param name="other">The other Rect2 to compare.</param>
|
|
|
|
+ /// <returns>Whether or not the Rect2s are approximately equal.</returns>
|
|
public bool IsEqualApprox(Rect2 other)
|
|
public bool IsEqualApprox(Rect2 other)
|
|
{
|
|
{
|
|
return _position.IsEqualApprox(other._position) && _size.IsEqualApprox(other.Size);
|
|
return _position.IsEqualApprox(other._position) && _size.IsEqualApprox(other.Size);
|