struct Glint::Rect
- Glint::Rect
- Struct
- Value
- Object
Overview
A notional rectangle in 2d space with x and y coordinates and a width and a height.
Defined in:
glint/rect.crConstructors
-
.new(x : Number, y : Number, width : Number, height : Number)
Creates a
Rectfrom x and y coordinates and a width and a height. -
.new(position : Position, width : Number, height : Number)
Creates a
Rectfrom a position, a width and a height. -
.new(x : Number, y : Number, size : Dimension)
Creates a
Rectfrom x and y coordinates and a size. -
.new(position : Position, size : Dimension)
Creates a
Rectfrom a position and a size. -
.new(r : Raylib::Rectangle)
Creates a
Rectfrom aRaylib::Rectangle. - .new(r : Rect)
Instance Method Summary
-
#adjust(&)
Takes a block and adjusts the
Rectin the way(s) defined by the block. -
#contract(amount : Number)
Returns a
Rectcontracted by an amount. -
#contract!(amount : Number)
Contracts the
Rectby an amount. -
#expand(amount : Number)
Returns a
Rectexpanded by an amount. -
#expand!(amount : Number)
Expands the
Rectby an amount. - #grow!(v : Vector2)
-
#height
Return the height of the
Rect. -
#height=(height : Number)
Set the height of the
Rect. -
#position
Returns the position of the
Rect. -
#position=(position : Position)
Sets the position of the
Rect. - #shift!(v : Vector2)
- #shrink!(v : Vector2)
-
#size
Returns the size of the
Rect. -
#size=(size : Dimension)
Sets the size of the
Rect. -
#to_hash
Returns the rect's values as a
Hash. -
#to_tuple
Returns the rect's values as a
Tuple. -
#to_unsafe : Raylib::Rectangle
Returns the rect in a C-compatible format, i.e.
- #to_vectors_hash
- #to_vectors_tuple
-
#values
Returns the rect's values as a
Tuple. -
#width
Return the width of the
Rect. -
#width=(width : Number)
Set the width of the
Rect. -
#x
Return the x position of the
Rect. -
#x=(x : Number)
Set the x position of the
Rect. -
#y
Return the y position of the
Rect. -
#y=(y : Number)
Set the y position of the
Rect.
Macro Summary
Constructor Detail
Creates a Rect from x and y coordinates and a width and a height.
Creates a Rect from a position, a width and a height.
Creates a Rect from x and y coordinates and a size.
Creates a Rect from a position and a size.
Instance Method Detail
Contracts the Rect by an amount.
The contraction occurs at all four corners.
Expands the Rect by an amount.
The expansion occurs at all four corners.
Returns the rect in a C-compatible format, i.e. as Raylib::Rectangle.
This allows for transparent interoperability with the Raylib library.