ScummVM API documentation
dgds_rect.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef DGDS_DGDS_RECT_H
23#define DGDS_DGDS_RECT_H
24
25#include "common/str.h"
26#include "common/rect.h"
27
28namespace Dgds {
29
30// TODO: This should be replaced by Common::Rect, but during dev it's easier
31// to have one that exactly matches semantics of the origingal game's struct.
32class DgdsRect {
33public:
34 DgdsRect(): x(0), y(0), width(0), height(0) {}
35 DgdsRect(int x_, int y_, int width_, int height_): x(x_), y(y_), width(width_), height(height_) {}
36 int x;
37 int y;
38 int width;
39 int height;
40
41 Common::Rect toCommonRect() const { return Common::Rect(x, y, x + width, y + height); }
42 bool contains(const Common::Point &pt) const { return pt.x >= x && pt.x < (x + width) && pt.y >= y && pt.y < (y + height); }
43 Common::String dump(const Common::String &indent) const;
44};
45
46} // end namespace Dgds
47
48#endif // DGDS_DGDS_RECT_H
Definition: str.h:59
Definition: dgds_rect.h:32
T y
Definition: rect.h:49
T x
Definition: rect.h:48
Definition: rect.h:144
Definition: rect.h:536