TONY: Move code from .h to .cpp files

This commit is contained in:
Strangerke 2012-09-02 10:34:11 +02:00
parent 1f41e55731
commit c737e64298
12 changed files with 279 additions and 145 deletions

View file

@ -86,6 +86,14 @@ RMPoint &RMPoint::operator=(RMPoint p) {
return *this;
}
/**
* Set a point
*/
void RMPoint::set(int x1, int y1) {
_x = x1;
_y = y1;
}
/**
* Offsets the point by another point
*/
@ -174,6 +182,9 @@ void RMPoint::readFromStream(Common::ReadStream &ds) {
* RMPointReference methods
\****************************************************************************/
RMPointReference::RMPointReference(int &x, int &y): _x(x), _y(y) {
}
RMPointReference &RMPointReference::operator=(const RMPoint &p) {
_x = p._x; _y = p._y;
return *this;
@ -184,6 +195,10 @@ RMPointReference &RMPointReference::operator-=(const RMPoint &p) {
return *this;
}
RMPointReference::operator RMPoint() const {
return RMPoint(_x, _y);
}
/****************************************************************************\
* RMRect methods
\****************************************************************************/
@ -233,6 +248,14 @@ void RMRect::copyRect(const RMRect &rc) {
_y2 = rc._y2;
}
RMPointReference &RMRect::topLeft() {
return _topLeft;
}
RMPointReference &RMRect::bottomRight() {
return _bottomRight;
}
RMPoint RMRect::center() {
return RMPoint((_x2 - _x1) / 2, (_y2 - _y1) / 2);
}
@ -328,6 +351,13 @@ void RMRect::readFromStream(Common::ReadStream &ds) {
_y2 = ds.readSint32LE();
}
/**
* Check if RMPoint is in RMRect
*/
bool RMRect::ptInRect(const RMPoint &pt) {
return (pt._x >= _x1 && pt._x <= _x2 && pt._y >= _y1 && pt._y <= _y2);
}
/****************************************************************************\
* Resource Update
\****************************************************************************/