2021-12-26 21:19:38 +01:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2008-06-13 14:57:47 +00:00
|
|
|
*
|
2021-12-26 21:19:38 +01:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
2008-06-13 14:57:47 +00:00
|
|
|
* file distributed with this source distribution.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
2021-12-26 18:47:58 +01:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-04-05 18:18:42 +02:00
|
|
|
*
|
2012-12-19 23:15:43 +01:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2006-04-02 14:20:45 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-12-19 23:15:43 +01:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-04-05 18:18:42 +02:00
|
|
|
*
|
2012-12-19 23:15:43 +01:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
|
|
|
*/
|
2005-04-07 19:29:06 +00:00
|
|
|
|
2009-05-26 09:39:42 +00:00
|
|
|
#ifndef GRIM_PRIMITIVESOBJECT_H
|
|
|
|
#define GRIM_PRIMITIVESOBJECT_H
|
2005-04-07 19:29:06 +00:00
|
|
|
|
2009-05-10 10:11:55 +00:00
|
|
|
#include "common/rect.h"
|
|
|
|
|
2011-09-07 23:08:59 +02:00
|
|
|
#include "engines/grim/pool.h"
|
2012-01-27 11:47:28 -08:00
|
|
|
#include "engines/grim/color.h"
|
2011-07-23 12:14:33 +02:00
|
|
|
|
2009-05-25 06:49:57 +00:00
|
|
|
namespace Grim {
|
|
|
|
|
2009-06-23 07:14:53 +00:00
|
|
|
class SaveGame;
|
|
|
|
|
2012-04-05 15:20:30 -07:00
|
|
|
class PrimitiveObject : public PoolObject<PrimitiveObject> {
|
2005-04-07 19:29:06 +00:00
|
|
|
public:
|
|
|
|
PrimitiveObject();
|
|
|
|
~PrimitiveObject();
|
|
|
|
|
2013-11-20 01:03:12 +01:00
|
|
|
enum PrimType {
|
|
|
|
RectangleType = 1,
|
|
|
|
LineType = 2,
|
|
|
|
PolygonType = 3,
|
|
|
|
InvalidType = 4
|
|
|
|
};
|
|
|
|
|
2012-04-05 15:20:30 -07:00
|
|
|
static int32 getStaticTag() { return MKTAG('P', 'R', 'I', 'M'); }
|
|
|
|
|
2012-05-05 18:03:04 -07:00
|
|
|
void createRectangle(const Common::Point &p1, const Common::Point &p2, const Color &color, bool filled);
|
|
|
|
void createLine(const Common::Point &p1, const Common::Point &p2, const Color &color);
|
|
|
|
void createPolygon(const Common::Point &p1, const Common::Point &p2, const Common::Point &p3, const Common::Point &p4, const Color &color);
|
|
|
|
Common::Point getP1() const { return _p1; }
|
|
|
|
Common::Point getP2() const { return _p2; }
|
|
|
|
Common::Point getP3() const { return _p3; }
|
|
|
|
Common::Point getP4() const { return _p4; }
|
2009-05-24 06:09:42 +00:00
|
|
|
void setPos(int x, int y);
|
2014-06-05 07:48:40 -07:00
|
|
|
void setEndpoint(int x, int y);
|
2012-01-27 11:47:28 -08:00
|
|
|
void setColor(const Color &color) { _color = color; }
|
2012-05-05 18:03:04 -07:00
|
|
|
Color getColor() const { return _color; }
|
2013-11-20 01:03:12 +01:00
|
|
|
PrimType getType() const { return _type; }
|
2012-05-05 18:03:04 -07:00
|
|
|
bool isFilled() const { return _filled; }
|
|
|
|
void draw() const;
|
2011-03-21 05:16:27 +08:00
|
|
|
void saveState(SaveGame *state) const;
|
2013-07-09 21:12:55 +02:00
|
|
|
bool restoreState(SaveGame *state);
|
2005-04-07 19:29:06 +00:00
|
|
|
|
|
|
|
private:
|
2009-05-10 10:11:55 +00:00
|
|
|
Common::Point _p1, _p2, _p3, _p4;
|
2012-01-27 11:47:28 -08:00
|
|
|
Color _color;
|
2005-04-07 19:29:06 +00:00
|
|
|
bool _filled;
|
2013-10-26 13:51:54 -07:00
|
|
|
PrimType _type;
|
2005-04-07 19:29:06 +00:00
|
|
|
};
|
|
|
|
|
2009-05-25 06:49:57 +00:00
|
|
|
} // end of namespace Grim
|
|
|
|
|
2005-04-07 19:29:06 +00:00
|
|
|
#endif
|