| Line | |
|---|
| 1 | /* $Id: rectangle.h,v 1.7 2001-10-05 12:33:10 sandervl Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Rectangle class used to keep track of locked rects in surfaces
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1999 Markus Montkowski
|
|---|
| 7 | *
|
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 9 | *
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 | #ifndef __DDRectandle
|
|---|
| 13 | #define __DDRectandle
|
|---|
| 14 |
|
|---|
| 15 | class DDRectangle {
|
|---|
| 16 | public:
|
|---|
| 17 | /*------------------------------ Related Types -------------------------------*/
|
|---|
| 18 | typedef long Coord;
|
|---|
| 19 |
|
|---|
| 20 | /*------------------------------- Constructors -------------------------------*/
|
|---|
| 21 | DDRectangle ( );
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | DDRectangle ( Coord point1X,
|
|---|
| 25 | Coord point1Y,
|
|---|
| 26 | Coord point2X,
|
|---|
| 27 | Coord point2Y );
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 | /*------------------------------- Comparisons --------------------------------*/
|
|---|
| 31 | BOOL
|
|---|
| 32 | operator == ( const DDRectangle &rectangle ) const,
|
|---|
| 33 | operator != ( const DDRectangle &rectangle ) const;
|
|---|
| 34 |
|
|---|
| 35 | /*--------------------------------- Testing ----------------------------------*/
|
|---|
| 36 | BOOL
|
|---|
| 37 | intersects ( const DDRectangle& rectangle ) const;
|
|---|
| 38 |
|
|---|
| 39 | Coord
|
|---|
| 40 | width() const,
|
|---|
| 41 | height() const;
|
|---|
| 42 |
|
|---|
| 43 | Coord Top() const
|
|---|
| 44 | {
|
|---|
| 45 | return lTop;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | Coord Left() const
|
|---|
| 49 | {
|
|---|
| 50 | return lLeft;
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | Coord Bottom() const
|
|---|
| 54 | {
|
|---|
| 55 | return lBottom;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | Coord Right() const
|
|---|
| 59 | {
|
|---|
| 60 | return lRight;
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | void* GetMemPtr();
|
|---|
| 64 | void SetMemPtr(void* NewMemPtr);
|
|---|
| 65 |
|
|---|
| 66 | private:
|
|---|
| 67 | void* pMemPtr; // Pointer to surface memory for this rectangle
|
|---|
| 68 | long lTop,lLeft;
|
|---|
| 69 | long lBottom,lRight;
|
|---|
| 70 | }; // class DDRectangle
|
|---|
| 71 |
|
|---|
| 72 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.