dsfml.graphics.rect



class Rect(T);
Rect is an utility class for manipulating rectangles. Template parameter defines the type of coordinates (integer float, ...)

this();
Default constructor

this(T leftCoord, T topCoord, T rightCoord, T bottomCoord);
Construct the rectangle from its coordinates

Params:
leftCoord Left coordinate of the rectangle
topCoord Top coordinate of the rectangle
rightCoord Right coordinate of the rectangle
bottomCoord Bottom coordinate of the rectangle

T getWidth();
Get the width of the rectangle

Returns:
Width of rectangle

T getHeight();
Get the height of the rectangle

Returns:
Height of rectangle

void offset(T offsetX, T offsetY);
Move the whole rectangle by the given offset

Params:
T offsetX Horizontal offset
T offsetY Vertical offset

bool contains(T x, T y);
Check if a point is inside the rectangle's area

Params:
T x X coordinate of the point to test
T y Y coordinate of the point to test

Returns:
True if the point is inside

bool intersects(Rect!(T) rectangle, out Rect!(T) overlappingRect = null);
Check intersection between two rectangles

Params:
Rect!(T) rectangle Rectangle to test
Rect!(T) overlappingRect Rectangle to be filled with overlapping rect (NULL by default)

Returns:
True if rectangles overlap

void setLeft(T left);
Set left Coordinate

void setTop(T top);
Set top Coordinate

void setRight(T right);
Set right Coordinate

void setBottom(T bottom);
Set bottom Coordinate

T getLeft();
Get left Coordinate

T getTop();
Get top Coordinate

T getRight();
Get right Coordinate

T getBottom();
Get bottom Coordinate

alias IntRect;
alias FloatRect;
Alias


Page generated by Ddoc.