struct Glint::Rect

Overview

A notional rectangle in 2d space with x and y coordinates and a width and a height.

Defined in:

glint/rect.cr

Constructors

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(x : Number, y : Number, width : Number, height : Number) #

Creates a Rect from x and y coordinates and a width and a height.


[View source]
def self.new(position : Position, width : Number, height : Number) #

Creates a Rect from a position, a width and a height.


[View source]
def self.new(x : Number, y : Number, size : Dimension) #

Creates a Rect from x and y coordinates and a size.


[View source]
def self.new(position : Position, size : Dimension) #

Creates a Rect from a position and a size.


[View source]
def self.new(r : Raylib::Rectangle) #

Creates a Rect from a Raylib::Rectangle.


[View source]
def self.new(r : Rect) #

Creates a Rect from another Rect.


[View source]

Instance Method Detail

def adjust(&) #

Takes a block and adjusts the Rect in the way(s) defined by the block.


[View source]
def contract(amount : Number) #

Returns a Rect contracted by an amount.


[View source]
def contract!(amount : Number) #

Contracts the Rect by an amount.

The contraction occurs at all four corners.


[View source]
def expand(amount : Number) #

Returns a Rect expanded by an amount.


[View source]
def expand!(amount : Number) #

Expands the Rect by an amount.

The expansion occurs at all four corners.


[View source]
def grow!(v : Vector2) #

Grow the size of the Rect by an amount in a Vector2.


[View source]
def height #

Return the height of the Rect.


[View source]
def height=(height : Number) #

Set the height of the Rect.


[View source]
def position #

Returns the position of the Rect.


[View source]
def position=(position : Position) #

Sets the position of the Rect.


[View source]
def shift!(v : Vector2) #

Shift the position of the Rect by an amount in a Vector2.


[View source]
def shrink!(v : Vector2) #

Shrinks the size of the Rect by an amount in a Vector2.


[View source]
def size #

Returns the size of the Rect.


[View source]
def size=(size : Dimension) #

Sets the size of the Rect.


[View source]
def to_hash #

Returns the rect's values as a Hash.


[View source]
def to_tuple #

Returns the rect's values as a Tuple.


[View source]
def to_unsafe : Raylib::Rectangle #

Returns the rect in a C-compatible format, i.e. as Raylib::Rectangle.

This allows for transparent interoperability with the Raylib library.


[View source]
def to_vectors_hash #

Returns a Hash of the #position and #size vectors.


[View source]
def to_vectors_tuple #

Returns a Tuple of the #position and #size vectors.


[View source]
def values #

Returns the rect's values as a Tuple.


[View source]
def width #

Return the width of the Rect.


[View source]
def width=(width : Number) #

Set the width of the Rect.


[View source]
def x #

Return the x position of the Rect.


[View source]
def x=(x : Number) #

Set the x position of the Rect.


[View source]
def y #

Return the y position of the Rect.


[View source]
def y=(y : Number) #

Set the y position of the Rect.


[View source]

Macro Detail

macro method_missing(call) #

[View source]