Rev | Line | |
---|
[6950] | 1 | /* $Id: rectangle.cpp,v 1.7 2001-10-05 12:33:10 sandervl Exp $ */
|
---|
[2174] | 2 |
|
---|
| 3 | /*
|
---|
| 4 | * Rectangle class Implementaion
|
---|
| 5 | *
|
---|
| 6 | * Copyright 1999 Markus Montkowski
|
---|
| 7 | *
|
---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 9 | *
|
---|
| 10 | */
|
---|
| 11 |
|
---|
[5344] | 12 | typedef unsigned long BOOL;
|
---|
[2174] | 13 |
|
---|
[352] | 14 | #include "rectangle.h"
|
---|
| 15 |
|
---|
[6935] | 16 | DDRectangle::DDRectangle ( Coord x1,
|
---|
| 17 | Coord y1,
|
---|
| 18 | Coord x2,
|
---|
| 19 | Coord y2 )
|
---|
[352] | 20 | {
|
---|
| 21 | lTop = y1;
|
---|
| 22 | lLeft = x1;
|
---|
| 23 | lBottom = y2;
|
---|
| 24 | lRight = x2;
|
---|
[405] | 25 | pMemPtr = 0;
|
---|
[352] | 26 | }
|
---|
| 27 |
|
---|
[2174] | 28 | BOOL DDRectangle::operator == ( const DDRectangle &aRect ) const
|
---|
[352] | 29 | {
|
---|
| 30 | return ( lTop == aRect.lTop && lLeft == aRect.lLeft
|
---|
| 31 | &&
|
---|
| 32 | lBottom == aRect.lBottom && lRight == aRect.lRight);
|
---|
| 33 | }
|
---|
[2174] | 34 | BOOL DDRectangle::operator != ( const DDRectangle& aRect ) const
|
---|
[352] | 35 | {
|
---|
| 36 | return !( *this == aRect );
|
---|
| 37 | }
|
---|
[2174] | 38 | BOOL DDRectangle::intersects ( const DDRectangle &aRect ) const
|
---|
[352] | 39 | {
|
---|
| 40 | return ( lTop < aRect.lBottom && lLeft<aRect.lRight
|
---|
| 41 | &&
|
---|
| 42 | aRect.lTop < lBottom && aRect.lLeft < lRight );
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | DDRectangle::Coord DDRectangle::width ( ) const
|
---|
| 46 | {
|
---|
| 47 | return ( lRight - lLeft);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | DDRectangle::Coord DDRectangle::height ( ) const
|
---|
| 51 | {
|
---|
| 52 | return ( lBottom - lTop);
|
---|
| 53 | }
|
---|
| 54 |
|
---|
[405] | 55 | void DDRectangle::SetMemPtr(void* NewMemPtr)
|
---|
| 56 | {
|
---|
| 57 | pMemPtr = NewMemPtr;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | void* DDRectangle::GetMemPtr()
|
---|
| 61 | {
|
---|
| 62 | return pMemPtr;
|
---|
| 63 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.