source: trunk/src/ddraw/rectangle.cpp@ 352

Last change on this file since 352 was 352, checked in by hugh, 26 years ago

Changhed from Isequence to DPA for managing rectangles and surfaces

File size: 920 bytes
Line 
1#include "rectangle.h"
2
3DDRectangle::DDRectangle ( Coord y1,
4 Coord x1,
5 Coord y2,
6 Coord x2 )
7{
8 lTop = y1;
9 lLeft = x1;
10 lBottom = y2;
11 lRight = x2;
12}
13
14IBase::Boolean DDRectangle::operator == ( const DDRectangle &aRect ) const
15 {
16 return ( lTop == aRect.lTop && lLeft == aRect.lLeft
17 &&
18 lBottom == aRect.lBottom && lRight == aRect.lRight);
19 }
20IBase::Boolean DDRectangle::operator != ( const DDRectangle& aRect ) const
21 {
22 return !( *this == aRect );
23 }
24IBase::Boolean DDRectangle::intersects ( const DDRectangle &aRect ) const
25{
26 return ( lTop < aRect.lBottom && lLeft<aRect.lRight
27 &&
28 aRect.lTop < lBottom && aRect.lLeft < lRight );
29}
30
31DDRectangle::Coord DDRectangle::width ( ) const
32{
33 return ( lRight - lLeft);
34}
35
36DDRectangle::Coord DDRectangle::height ( ) const
37{
38 return ( lBottom - lTop);
39}
40
Note: See TracBrowser for help on using the repository browser.