1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
|
#include "CRectangle.h"
CRectangle::CRectangle(char fillChar)
{
m_fillChar = fillChar;
}
CRectangle::CRectangle(CPoint bottomLeft, CPoint topRight, char fillChar)
{
m_topRight= topRight;
if(topRight.x < bottomLeft.x) {
m_bottomLeft.x = bottomLeft.x;
}
if(topRight.x > bottomLeft.x) {
m_bottomLeft.y = bottomLeft.y;
}
if(topRight.y < bottomLeft.y) {
m_bottomLeft.y = bottomLeft.y;
}
if(topRight.y > bottomLeft.y) {
m_bottomLeft.x = bottomLeft.y;
}
}
void CRectangle::setCorners(CPoint bottomLeft, CPoint topRight)
{
if (bottomLeft.x <= topRight.x && bottomLeft.y <= topRight.y) {
m_bottomLeft = bottomLeft;
m_topRight = topRight;
}
}
CPoint CRectangle::getBottomLeftCorner() const
{
// Bitte implementieren und dabei das return-Statement ersetzen.
return m_BottomLeftCorner();
}
CPoint CRectangle::getTopRightCorner() const
{
// Bitte implementieren und dabei das return-Statement ersetzen.
return m_TopRightCorner();
}
void CRectangle::setFillChar(char fillChar)
{
// Bitte implementieren
}
char CRectangle::getFillChar() const
{
// Bitte implementieren und dabei das return-Statement ersetzen.
return 0;
}
bool CRectangle::operator ==(const CRectangle& other) const
{
// Bitte implementieren und dabei das return-Statement ersetzen.
return false;
}
void CRectangle::draw(CScreen& screen) const
{
// Bitte implementieren
}
|