โ๏ธrect
__call๏ปฟ
Constructor
Creates a new rectangle.
Arguments
1. Default rectangle (0, 0 position; 0, 0 size).
None.
2. Single value.
value
float
Mins XY, maxs XY value.
3. Single vector.
4. Double value.
x
float
Mins/maxs X coordinate.
y
float
Mins/maxs Y coordinate.
5. Double vector.
6. Four values.
x0
float
Mins X coordinate.
y0
float
Mins Y coordinate.
x1
float
Maxs X coordinate.
y1
float
Maxs Y coordinate.
Returns
rect
New rectangle.
Example
mins๏ปฟ
Field
Type: vec2
Mins (top-left) vector.
maxs๏ปฟ
Field
Type: vec2
Maxs (bottom-right) vector.
width๏ปฟ
Method
Either returns rectangle's width, or sets a new width.
Arguments
1. Get width.
None.
2. Set width.
value
float
New width.
Returns
1. Get width.
float
Width.
2. Set width.
rect
New rectangle with changed width.
Example
height๏ปฟ
Method
Either returns rectangle's height, or sets a new height.
Arguments
1. Get height.
None.
2. Set height.
value
float
New height.
Returns
1. Get height.
float
Height.
2. Set height.
rect
New rectangle with changed height.
Example
size๏ปฟ
Method
Either returns rectangle's size, or sets a new size.
Arguments
1. Get size.
None.
2. Set size.
Returns
1. Get size.
Size.
2. Set size.
rect
New rectangle with changed size.
Example
explode๏ปฟ
Method
Explodes the rectangle by given vector (increase size from center into all directions by coordinates in the vector).
Arguments
Returns
rect
Exploded rectangle.
Example
half_width๏ปฟ
Method
Returns a rectangle with half of the width of this rectangle.
Arguments
None.
Returns
rect
Rectangle with halved width.
Example
translate๏ปฟ
Method
Translates (moves) this rectangle by vector coordinates.
Arguments
Returns
rect
Translated rectangle.
Example
margin_left๏ปฟ
Method
Move rectangle from the left by given amount.
Arguments
value
float
Margin amount.
Returns
rect
Moved rectangle.
Example
margin_right๏ปฟ
Method
Move rectangle from the right by given amount.
Arguments
value
float
Margin amount.
Returns
rect
Moved rectangle.
Example
margin_top๏ปฟ
Method
Move rectangle from the top by given amount.
Arguments
value
float
Margin amount.
Returns
rect
Moved rectangle.
Example
margin_bottom๏ปฟ
Method
Move rectangle from the bottom by given amount.
Arguments
value
float
Margin amount.
Returns
rect
Moved rectangle.
Example
padding_left๏ปฟ
Method
Adds the value to the left side of the rectangle.
Arguments
value
float
Padding amount.
Returns
rect
Resized rectangle.
Example
padding_right๏ปฟ
Method
Adds the value to the right side of the rectangle.
Arguments
value
float
Padding amount.
Returns
rect
Resized rectangle.
Example
padding_top๏ปฟ
Method
Adds the value to the top side of the rectangle.
Arguments
value
float
Padding amount.
Returns
rect
Resized rectangle.
Example
padding_bottom๏ปฟ
Method
Adds the value to the bottom side of the rectangle.
Arguments
value
float
Padding amount.
Returns
rect
Resized rectangle.
Example
shrink๏ปฟ
Method
Shrinks (implodes) the rectangle by given amount.
Arguments
value
float
Shrink value.
Returns
rect
Resized rectangle.
Example
expand๏ปฟ
Method
Expands (explodes) the rectangle by given amount.
Arguments
value
float
Expand value.
Returns
rect
Resized rectangle.
Example
contains๏ปฟ
Method
Returns true if this rectangle contains either vector or another rectangle.
Arguments
1. Vector variant.
2. Rectangle variant.
other
rect
Rectangle to check against.
Returns
bool
true if other object is in bounds of this rectangle.
Example
overlaps๏ปฟ
Method
Returns true if the other rectangle overlaps with this rectangle.
Arguments
other
rect
Rectangle to check against.
Returns
bool
true if other rectangle overlaps with this rectangle.
Example
intersect๏ปฟ
Method
Intersects this rectangle with another rectangle.
Arguments
other
rect
Rectangle to intersect with.
Returns
rect
Intersected rectangle.
Example
tl๏ปฟ
Method
Returns top-left vector.
Arguments
None.
Returns
Top-left vector.
Example
tr๏ปฟ
Method
Returns top-right vector.
Arguments
None.
Returns
Top-right vector.
Example
br๏ปฟ
Method
Returns bottom-right vector.
Arguments
None.
Returns
Bottom-right vector.
Example
bl๏ปฟ
Method
Returns bottom-left vector.
Arguments
None.
Returns
Bottom-left vector.
Example
center๏ปฟ
Method
Returns center point of this rectangle.
Arguments
None.
Returns
Center point.
Example
circle๏ปฟ
Method
Treats this rectangle as an ellipsis and returns point on it. Note, that this "ellipsis" will be perfect with no modified curvature (basically if this rectangle is a box - you will get a point on a perfect circle).
Arguments
r
float
Radians value.
Returns
Point on the ellipsis.
Example
floor๏ปฟ
Method
Returns floored rectangle.
Arguments
None.
Returns
rect
Floored rectangle.
Example
ceil๏ปฟ
Method
Returns ceiled rectangle.
Arguments
None.
Returns
rect
Ceiled rectangle.
Example
round๏ปฟ
Method
Returns rounded rectangle.
Arguments
None.
Returns
rect
Rounded rectangle.
Example
is_zero๏ปฟ
Method
Returns true if both mins and maxs are equal to 0.
Arguments
None.
Returns
bool
true if this is a zero rectangle.
Example
Last updated