struct
Godot::Rect2
- Godot::Rect2
- Struct
- Value
- Object
Overview
2D axis-aligned bounding box defined by a position and size with 32-bit floating point precision.
Defined in:
libgodot/types/rect2.crConstructors
- .new(x : Number, y : Number, width : Number, height : Number)
- .new(position : Vector2 = Vector2.new, size : Vector2 = Vector2.new)
- .new(pointer : Pointer(Void))
Instance Method Summary
- #!=(other : Rect2) : Bool
- #==(other : Rect2) : Bool
-
#abs : Rect2
Returns a Rect2 with non-negative width and height.
-
#area : Float32
Returns the surface area of this Rect2.
-
#encloses(b : Rect2) : Bool
Returns true if this Rect2 completely encloses another.
- #encloses?(b : Rect2) : Bool
-
#end : Vector2
Returns the ending point (position + size).
- #end=(value : Vector2)
-
#expand(to : Vector2) : Rect2
Returns a larger Rect2 that includes the given point.
-
#grow(by : Number) : Rect2
Returns a copy of this Rect2 grown by the given amount on all sides.
-
#grow_individual(left : Number, top : Number, right : Number, bottom : Number) : Rect2
Returns a copy of this Rect2 grown individually on each side.
-
#has_area? : Bool
Returns true if this Rect2 has a positive area.
-
#has_point(point : Vector2) : Bool
Returns true if the point is inside the rectangle.
- #has_point?(point : Vector2) : Bool
-
#intersection(b : Rect2) : Rect2
Returns the intersection of this Rect2 and another.
-
#intersects(b : Rect2, include_borders : Bool = false) : Bool
Returns true if this Rect2 intersects with another.
- #intersects?(b : Rect2) : Bool
- #is_equal_approx(other : Rect2) : Bool
-
#merge(b : Rect2) : Rect2
Returns a larger Rect2 that encloses both this and another Rect2.
- #position : Vector2
- #position=(position : Vector2)
- #size : Vector2
- #size=(size : Vector2)
- #to_i : Rect2i
-
#to_s(io : IO) : Void
Same as
#inspect(io).
Constructor Detail
Instance Method Detail
Returns a copy of this Rect2 grown by the given amount on all sides.
Returns a copy of this Rect2 grown individually on each side.
Returns true if this Rect2 intersects with another.