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 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 ASYLUM_RESOURCES_POLYGONS_H 24 #define ASYLUM_RESOURCES_POLYGONS_H 25 26 #include "common/array.h" 27 #include "common/rect.h" 28 #include "common/stream.h" 29 30 #define MAX_POLYGONS 200 31 32 namespace Asylum { 33 34 class Polygon { 35 public: 36 Common::Array<Common::Point> points; 37 Common::Rect boundingRect; 38 Polygon()39 Polygon() {}; Polygon(Common::Point point1,Common::Point point2,Common::Point point3,Common::Point point4)40 Polygon(Common::Point point1, Common::Point point2, Common::Point point3, Common::Point point4) { 41 points.push_back(point1); 42 points.push_back(point2); 43 points.push_back(point3); 44 points.push_back(point4); 45 } 46 47 bool contains(const Common::Point &point); count()48 uint32 count() { return points.size(); } 49 }; 50 51 class Polygons { 52 public: 53 Polygons(Common::SeekableReadStream *stream); 54 virtual ~Polygons(); 55 56 Polygon get(uint32 index); size()57 uint32 size() { return _entries.size(); } 58 59 private: 60 int32 _size; 61 int32 _numEntries; 62 63 Common::Array<Polygon> _entries; 64 65 void load(Common::SeekableReadStream *stream); 66 }; // end of class Polygons 67 68 } // end of namespace Asylum 69 70 #endif // ASYLUM_RESOURCES_POLYGONS_H 71