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

Last change on this file since 5344 was 5344, checked in by mike, 24 years ago

Cleaned up DDRAW for Watcom

File size: 1.5 KB
Line 
1/* $Id: rectangle.cpp,v 1.5 2001-03-20 23:18:56 mike Exp $ */
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
12typedef unsigned long BOOL;
13
14#include "rectangle.h"
15
16DDRectangle::DDRectangle ( Coord y1,
17 Coord x1,
18 Coord y2,
19 Coord x2 )
20{
21 lTop = y1;
22 lLeft = x1;
23 lBottom = y2;
24 lRight = x2;
25 pMemPtr = 0;
26}
27
28BOOL DDRectangle::operator == ( const DDRectangle &aRect ) const
29 {
30 return ( lTop == aRect.lTop && lLeft == aRect.lLeft
31 &&
32 lBottom == aRect.lBottom && lRight == aRect.lRight);
33 }
34BOOL DDRectangle::operator != ( const DDRectangle& aRect ) const
35 {
36 return !( *this == aRect );
37 }
38BOOL DDRectangle::intersects ( const DDRectangle &aRect ) const
39{
40 return ( lTop < aRect.lBottom && lLeft<aRect.lRight
41 &&
42 aRect.lTop < lBottom && aRect.lLeft < lRight );
43}
44
45DDRectangle::Coord DDRectangle::width ( ) const
46{
47 return ( lRight - lLeft);
48}
49
50DDRectangle::Coord DDRectangle::height ( ) const
51{
52 return ( lBottom - lTop);
53}
54
55DDRectangle::Coord DDRectangle::Top() const
56{
57 return lTop;
58}
59
60DDRectangle::Coord DDRectangle::Left() const
61{
62 return lLeft;
63}
64
65DDRectangle::Coord DDRectangle::Bottom() const
66{
67 return lBottom;
68}
69
70DDRectangle::Coord DDRectangle::Right() const
71{
72 return lRight;
73}
74
75void DDRectangle::SetMemPtr(void* NewMemPtr)
76{
77 pMemPtr = NewMemPtr;
78}
79
80void* DDRectangle::GetMemPtr()
81{
82 return pMemPtr;
83}
Note: See TracBrowser for help on using the repository browser.