Box

Graphics primitive. Represents a box on a 2D field. Note on area calculation: The smallest box that can be represented is 1 * 1, as it counts the endpoints as part of the box. This behavior got added with 0.10.0, to standardize various behaviors of the engine, and fix some odd behavior the GUI drawing functions had.

Constructors

this
this(int left, int top, int right, int bottom)
Undocumented in source.

Members

Functions

isBetween
bool isBetween(int x, int y)
bool isBetween(Point p)

Returns true if the given point is between the coordinates.

move
void move(int x, int y)

Moves the box to the given position.

opBinary
Box opBinary(int rhs)

Operator overloading for scalar values. -: Adds to left and top, substracts from right and bottom. (Shrinks by amount) +: Subtracts from left and top, adds to right and bottom. (Grows by amount)

pad
Box pad(int horiz, int vert)

Pads the edges of the given box by the given amounts and returns a new Box.

relMove
void relMove(int x, int y)

Moves the box by the given values.

toString
string toString()

Returns a string with the coordinates that is useful for debugging

Properties

area
size_t area [@property getter]

Returns the area of the represented box.

cornerLL
Point cornerLL [@property getter]

Returns the lowew-left corner.

cornerLR
Point cornerLR [@property getter]

Returns the lower-right corner.

cornerUL
Point cornerUL [@property getter]

Returns the upper-left corner.

cornerUR
Point cornerUR [@property getter]

Returns the upper-right corner.

height
int height [@property getter]

Returns the height of the represented box.

height
int height [@property setter]

Sets the height of the represented box while keeping the top coordinate.

width
int width [@property getter]

Returns the width of the represented box.

width
int width [@property setter]

Sets the width of the represented box while keeping the lefthand coordinate.

Static functions

bySize
Box bySize(int x, int y, int w, int h)
bottom
int bottom;
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

left
int left;
right
int right;
top
int top;
Undocumented in source.

Meta