ScummVM API documentation
primitives.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 GRIM_PRIMITIVESOBJECT_H
23 #define GRIM_PRIMITIVESOBJECT_H
24 
25 #include "common/rect.h"
26 
27 #include "engines/grim/pool.h"
28 #include "engines/grim/color.h"
29 
30 namespace Grim {
31 
32 class SaveGame;
33 
34 class PrimitiveObject : public PoolObject<PrimitiveObject> {
35 public:
37  ~PrimitiveObject();
38 
39  enum PrimType {
40  RectangleType = 1,
41  LineType = 2,
42  PolygonType = 3,
43  InvalidType = 4
44  };
45 
46  static int32 getStaticTag() { return MKTAG('P', 'R', 'I', 'M'); }
47 
48  void createRectangle(const Common::Point &p1, const Common::Point &p2, const Color &color, bool filled);
49  void createLine(const Common::Point &p1, const Common::Point &p2, const Color &color);
50  void createPolygon(const Common::Point &p1, const Common::Point &p2, const Common::Point &p3, const Common::Point &p4, const Color &color);
51  Common::Point getP1() const { return _p1; }
52  Common::Point getP2() const { return _p2; }
53  Common::Point getP3() const { return _p3; }
54  Common::Point getP4() const { return _p4; }
55  void setPos(int x, int y);
56  void setEndpoint(int x, int y);
57  void setColor(const Color &color) { _color = color; }
58  Color getColor() const { return _color; }
59  PrimType getType() const { return _type; }
60  bool isFilled() const { return _filled; }
61  void draw() const;
62  void saveState(SaveGame *state) const;
63  bool restoreState(SaveGame *state);
64 
65 private:
66  Common::Point _p1, _p2, _p3, _p4;
67  Color _color;
68  bool _filled;
69  PrimType _type;
70 };
71 
72 } // end of namespace Grim
73 
74 #endif
Definition: savegame.h:33
Definition: actor.h:33
Definition: rect.h:45
Definition: primitives.h:34
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Definition: pool.h:42
Definition: color.h:29