From 7eef0aaedefc5d3c73301bcb02834e165124c7e6 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Mon, 21 Aug 2006 16:06:50 +0000 Subject: added overlays and smooth scrolling. (someone who knows what he is doing has to create the makefiles for the unix users) --- src/resources/mapreader.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/resources/mapreader.cpp') diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 382b0797..c1ae911c 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -34,6 +34,7 @@ #include "../map.h" #include "../tileset.h" +#include "../utils/tostring.h" const unsigned int DEFAULT_TILE_WIDTH = 32; const unsigned int DEFAULT_TILE_HEIGHT = 32; @@ -213,6 +214,32 @@ MapReader::readMap(xmlNodePtr node, const std::string &path) } } + //set Overlays + int i = 0; + ResourceManager *resman = ResourceManager::getInstance(); + + while (map->hasProperty("overlay" + toString(i) + "image")) + { + Image *overlayImage = resman->getImage(map->getProperty("overlay" + toString(i) + "image")); + float scrollX = 0.0f; + float scrollY = 0.0f; + float parallax = 0.0f; + if (map->hasProperty("overlay" + toString(i) + "scrollX")) + { + scrollX = atof(map->getProperty("overlay" + toString(i) + "scrollX").c_str()); + } + if (map->hasProperty("overlay" + toString(i) + "scrollY")) + { + scrollY = atof(map->getProperty("overlay" + toString(i) + "scrollY").c_str()); + } + if (map->hasProperty("overlay" + toString(i) + "parallax")) + { + parallax = atof(map->getProperty("overlay" + toString(i) + "parallax").c_str()); + } + map->setOverlay (overlayImage, scrollX, scrollY, parallax); + i++; + } + return map; } -- cgit v1.2.3-70-g09d2