Microsoft DirectX 8.1 (Visual Basic) |
Throughout Microsoft® Direct3D® and Microsoft Windows® programming, objects on the screen are referred to in terms of bounding rectangles. The sides of a bounding rectangle are always parallel to the sides of the screen, so the rectangle can be described by two points, the top-left corner and bottom-right corner. Most applications use the RECT structure to carry information about a bounding rectangle to use when blitting to the screen or performing hit detection.
In Microsoft Visual Basic®, the RECT type has the following definition.
Type RECT Left As Long ' This is the top-left corner x-coordinate. Top As Long ' The top-left corner y-coordinate. Right As Long ' The bottom-right corner x-coordinate. Bottom As Long ' The bottom-right corner y-coordinate. End Type
In the preceding example, the left and top members are the x- and y-coordinates of a bounding rectangle's top-left corner. Similarly, the right and bottom members make up the coordinates of the bottom-right corner. The following diagram illustrates how you can visualize these values.
In the interest of efficiency, consistency, and ease of use, all Direct3D presentation functions work with rectangles.