22 #ifndef WINTERMUTE_RECT32_H 23 #define WINTERMUTE_RECT32_H 25 #include "common/system.h" 26 #include "engines/wintermute/math/floatpoint.h" 27 #include "common/rect.h" 35 Point32(int32 x1, int32 y1) : x(x1), y(y1) {}
36 bool operator==(
const Point32 &p)
const {
return x == p.x && y == p.y; }
37 bool operator!=(
const Point32 &p)
const {
return x != p.x || y != p.y; }
64 Rect32() : top(0), left(0), bottom(0), right(0) {}
65 Rect32(int32 w, int32 h) : top(0), left(0), bottom(h), right(w) {}
67 Rect32(int32 x1, int32 y1, int32 x2, int32 y2) : top(y1), left(x1), bottom(y2), right(x2) {
68 assert(isValidRect());
70 bool operator==(
const Rect32 &rhs)
const {
73 bool operator!=(
const Rect32 &rhs)
const {
80 int32 height()
const {
84 void setWidth(int32 aWidth) {
85 right = left + aWidth;
88 void setHeight(int32 aHeight) {
89 bottom = top + aHeight;
93 left = right = top = bottom = 0;
96 bool isRectEmpty()
const {
97 return (left >= right) || (top >= bottom);
100 void offsetRect(
int dx,
int dy) {
107 void setRect(int32 newLeft, int32 newTop, int32 newRight, int32 newBottom) {
108 this->left = newLeft;
110 this->right = newRight;
111 this->bottom = newBottom;
122 return (left == r.
left) && (right == r.
right) && (top == r.top) && (bottom == r.bottom);
125 bool isValidRect()
const {
126 return (left <= right && top <= bottom);
Definition: floatpoint.h:27
int32 left
The point at the top left of the rectangle (part of the rect).
Definition: rect32.h:61
int16 right
Definition: rect.h:146
int16 left
Definition: rect.h:145
int32 right
The point at the bottom right of the rectangle (not part of the rect).
Definition: rect32.h:62
bool equals(const Rect32 &r) const
Definition: rect32.h:121
Definition: achievements_tables.h:27