# Dgame.Math.Rect

Bottom

struct Size;
Size contains a width and a height property and is used to wraps both, the width and the height, in one element.

uint width;
the width property

uint height;
the height property

struct Rect;
Rect defines a rectangle structure that contains the left upper corner and the width/height.

Author:

enum Edge: ubyte;
The edges of the Rectangle

Top
Top edge

Bottom
Bottom edge

Left
Left edge

Right
Right edge

TopLeft
TopLeft edge

TopRight
TopRight edge

BottomLeft
BottomLeft edge

BottomRight
BottomRight edge

int x;
The x coordinate

int y;
The y coordinates

uint width;
The width

uint height;
The height

pure nothrow @nogc this(int x, int y, uint width, uint height);
CTor

const pure nothrow @nogc Rect opBinary(string op)(ref const Rect rect);
Supported operations: +, -, *, /, %

pure nothrow @nogc void collapse();
Collapse this Rect. Means that the size is set to 0.

const pure nothrow @nogc bool isEmpty();
Checks if this Rect is empty (if it's collapsed) with SDL_RectEmpty.

const @nogc Rect getUnion(ref const Rect rect);
Returns an union of the given and this Rect.

const pure nothrow @nogc bool contains()(auto ref const Vector2i vec);
Checks whether this Rect contains the given coordinates.

const pure nothrow @nogc bool contains(int x, int y);
Checks whether this Rect contains the given coordinates.

const pure nothrow @nogc bool opEquals(ref const Rect rect);
opEquals:
compares two rectangles on their coordinates and their size (but not explicit type).

const @nogc bool intersects(ref const Rect rect, Rect* overlap = null);
Checks whether this Rect intersects with an other. If, and the parameter 'overlap' isn't null, the colliding rectangle is stored there.

pure nothrow @nogc void setSize(uint width, uint height);
Replace the current size.

pure nothrow @nogc void setSize()(auto ref const Size size);
Replace the current size.

const pure nothrow @nogc Size getSize();
Returns the current size as Vector2

pure nothrow @nogc void increase(int width, int height);
Increase current size.

pure nothrow @nogc void setPosition(int x, int y);
Set a new position with coordinates.

pure nothrow @nogc void setPosition()(auto ref const Vector2i position);
Set a new position with a vector.

const pure nothrow @nogc Vector2i getPosition();
Returns the current position as Vector2

pure nothrow @nogc void move()(auto ref const Vector2i vec);
Move the object.

pure nothrow @nogc void move(int x, int y);
Move the object.

const pure nothrow @nogc Vector2i getEdgePosition(Edge edge);
Returns the position of the given Edge on this Rect.

const pure nothrow @nogc Vector2i getCenter();
Returns the center position of this Rect

Page generated by Ddoc.
Top