1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the AUTHORS
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef GRIM_PRIMITIVESOBJECT_H
24 #define GRIM_PRIMITIVESOBJECT_H
25 
26 #include "common/rect.h"
27 
28 #include "engines/grim/pool.h"
29 #include "engines/grim/color.h"
30 
31 namespace Grim {
32 
33 class SaveGame;
34 
35 class PrimitiveObject : public PoolObject<PrimitiveObject> {
36 public:
37 	PrimitiveObject();
38 	~PrimitiveObject();
39 
40 	enum PrimType {
41 		RectangleType = 1,
42 		LineType      = 2,
43 		PolygonType   = 3,
44 		InvalidType   = 4
45 	};
46 
getStaticTag()47 	static int32 getStaticTag() { return MKTAG('P', 'R', 'I', 'M'); }
48 
49 	void createRectangle(const Common::Point &p1, const Common::Point &p2, const Color &color, bool filled);
50 	void createLine(const Common::Point &p1, const Common::Point &p2, const Color &color);
51 	void createPolygon(const Common::Point &p1, const Common::Point &p2, const Common::Point &p3, const Common::Point &p4, const Color &color);
getP1()52 	Common::Point getP1() const { return _p1; }
getP2()53 	Common::Point getP2() const { return _p2; }
getP3()54 	Common::Point getP3() const { return _p3; }
getP4()55 	Common::Point getP4() const { return _p4; }
56 	void setPos(int x, int y);
57 	void setEndpoint(int x, int y);
setColor(const Color & color)58 	void setColor(const Color &color) { _color = color; }
getColor()59 	Color getColor() const { return _color; }
getType()60 	PrimType getType() const { return _type; }
isFilled()61 	bool isFilled() const { return _filled; }
62 	void draw() const;
63 	void saveState(SaveGame *state) const;
64 	bool restoreState(SaveGame *state);
65 
66 private:
67 	Common::Point _p1, _p2, _p3, _p4;
68 	Color _color;
69 	bool _filled;
70 	PrimType _type;
71 };
72 
73 } // end of namespace Grim
74 
75 #endif
76