diff options
author | Stephen Kennedy | 2008-08-07 16:38:39 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-08-07 16:38:39 +0000 |
commit | 2645ca48ad9bc219b43ab88cc5b071952297a992 (patch) | |
tree | d1383869820354fb99560d630c0d694535d5ad61 /common | |
parent | 66e4e3ec1a038bc653bb1c04893c39033ac3fb62 (diff) | |
download | scummvm-rg350-2645ca48ad9bc219b43ab88cc5b071952297a992.tar.gz scummvm-rg350-2645ca48ad9bc219b43ab88cc5b071952297a992.tar.bz2 scummvm-rg350-2645ca48ad9bc219b43ab88cc5b071952297a992.zip |
* Moved VK code into backends/vkeybd
* Moved Keymapper code into backends/keymapper
svn-id: r33681
Diffstat (limited to 'common')
-rw-r--r-- | common/image-map.cpp | 69 | ||||
-rw-r--r-- | common/image-map.h | 53 | ||||
-rw-r--r-- | common/module.mk | 2 | ||||
-rw-r--r-- | common/polygon.cpp | 55 | ||||
-rw-r--r-- | common/polygon.h | 114 |
5 files changed, 0 insertions, 293 deletions
diff --git a/common/image-map.cpp b/common/image-map.cpp deleted file mode 100644 index 84b22b4f1f..0000000000 --- a/common/image-map.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "common/image-map.h" - -namespace Common { - -ImageMap::~ImageMap() { - removeAllAreas(); -} - -Polygon *ImageMap::createArea(const String& id) { - if (_areas.contains(id)) { - warning("Image map already contains an area with target of '%s'", id.c_str()); - return 0; - } - Polygon *p = new Polygon(); - _areas[id] = p; - return p; -} - -void ImageMap::removeArea(const String& id) { - if (!_areas.contains(id)) - return; - delete _areas[id]; - _areas.erase(id); -} - -void ImageMap::removeAllAreas() { - HashMap<String, Polygon*>::iterator it; - for (it = _areas.begin(); it != _areas.end(); it++) { - delete it->_value; - } - _areas.clear(); -} - -String ImageMap::findMapArea(int16 x, int16 y) { - HashMap<String, Polygon*>::iterator it; - for (it = _areas.begin(); it != _areas.end(); it++) { - if (it->_value->contains(x, y)) - return it->_key; - } - return ""; -} - - -} // End of namespace Common diff --git a/common/image-map.h b/common/image-map.h deleted file mode 100644 index ee64d96ba1..0000000000 --- a/common/image-map.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef COMMON_IMAGEMAP_H -#define COMMON_IMAGEMAP_H - -#include "common/hashmap.h" -#include "common/hash-str.h" -#include "common/polygon.h" - -namespace Common { - -class ImageMap { - -public: - - ~ImageMap(); - - Polygon *createArea(const String& id); - void removeArea(const String& id); - void removeAllAreas(); - String findMapArea(int16 x, int16 y); - -protected: - HashMap<String, Polygon*> _areas; -}; - - -} // End of namespace Common - -#endif diff --git a/common/module.mk b/common/module.mk index e947b7ddd9..ed15bf75ea 100644 --- a/common/module.mk +++ b/common/module.mk @@ -6,12 +6,10 @@ MODULE_OBJS := \ config-manager.o \ file.o \ fs.o \ - image-map.o \ hashmap.o \ memorypool.o \ md5.o \ mutex.o \ - polygon.o \ str.o \ stream.o \ util.o \ diff --git a/common/polygon.cpp b/common/polygon.cpp deleted file mode 100644 index c1332b0bc4..0000000000 --- a/common/polygon.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "common/polygon.h" - -namespace Common { - -bool Polygon::contains(int16 x, int16 y) const { - int yflag0; - int yflag1; - bool inside_flag = false; - unsigned int pt; - - const Point *vtx0 = &_points[_points.size() - 1]; - const Point *vtx1 = &_points[0]; - - yflag0 = (vtx0->y >= y); - for (pt = 0; pt < _points.size(); pt++, vtx1++) { - yflag1 = (vtx1->y >= y); - if (yflag0 != yflag1) { - if (((vtx1->y - y) * (vtx0->x - vtx1->x) >= - (vtx1->x - x) * (vtx0->y - vtx1->y)) == yflag1) { - inside_flag = !inside_flag; - } - } - yflag0 = yflag1; - vtx0 = vtx1; - } - - return inside_flag; -} - -} // end of namespace Common diff --git a/common/polygon.h b/common/polygon.h deleted file mode 100644 index 69df2c0ca3..0000000000 --- a/common/polygon.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef COMMON_POLYGON_H -#define COMMON_POLYGON_H - -#include "common/array.h" -#include "common/rect.h" - -namespace Common { - -struct Polygon { - - - Polygon() {} - Polygon(const Polygon& p) : _points(p._points), _bound(p._bound) {} - Polygon(Array<Point> p) : _points(p) { - if (p.empty()) return; - _bound = Rect(p[0].x, p[0].y, p[0].x, p[0].y); - for (uint i = 1; i < p.size(); i++) { - _bound.extend(Rect(p[i].x, p[i].y, p[i].x, p[i].y)); - } - } - Polygon(Point *p, int n) { - for (int i = 0; i < n; i++) { - addPoint(p[i]); - } - } - virtual ~Polygon() {} - - void addPoint(const Point& p) { - _points.push_back(p); - _bound.extend(Rect(p.x, p.y, p.x, p.y)); - } - - void addPoint(int16 x, int16 y) { - addPoint(Point(x,y)); - } - - uint getPointCount() { - return _points.size(); - } - - /*! @brief check if given position is inside this polygon - - @param x the horizontal position to check - @param y the vertical position to check - - @return true if the given position is inside this polygon, false otherwise - */ - virtual bool contains(int16 x, int16 y) const; - - /*! @brief check if given point is inside this polygon - - @param p the point to check - - @return true if the given point is inside this polygon, false otherwise - */ - virtual bool contains(const Point &p) const { - return contains(p.x, p.y); - } - - virtual void moveTo(int16 x, int16 y) { - int16 dx = x - ((_bound.right + _bound.left) / 2); - int16 dy = y - ((_bound.bottom + _bound.top) / 2); - translate(dx, dy); - } - - virtual void moveTo(const Point &p) { - moveTo(p.x, p.y); - } - - virtual void translate(int16 dx, int16 dy) { - Array<Point>::iterator it; - for (it = _points.begin(); it != _points.end(); it++) { - it->x += dx; - it->y += dy; - } - } - - virtual Rect getBoundingRect() const { - return _bound; - } - -private: - Array<Point> _points; - Rect _bound; -}; - -} // end of namespace Common - -#endif |