Class: Rect

The Rect class is used to represent a rectangular shape in screen coordinates.

Member Variables


left (int)

The left-most pixel in the rectangle.


top (int)

The top-most pixel in the rectangle.


right (int)

The right-most pixel in the rectangle.


bottom (int)

The bottom-most pixel in the rectangle.

Member Functions


void Normalize()

This function "normalizes" a rectangle to ensure that the left value is smaller than the right, and the top value is smaller than the bottom. This should always be true of a well-behaved rectangle, and this function makes sure that is the case.

Return value: none
bool Contains(point)

Tests whether the rectangle contains the given point.

point (Point): a point that is being tested for inclusion in the rectangle Return value (bool): true if the point is contained in the rectangle, otherwise false