From 42411c8963eec06448a5dbf565add0540d6987f1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 3 Oct 2012 13:01:51 +0300 Subject: Add support for dye in atlasmanager. --- src/resources/atlasmanager.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/resources/atlasmanager.cpp') diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp index 5a43454b4..cd3d1d9db 100644 --- a/src/resources/atlasmanager.cpp +++ b/src/resources/atlasmanager.cpp @@ -23,7 +23,6 @@ #ifdef USE_OPENGL #include "resources/atlasmanager.h" -#include "resources/openglimagehelper.h" #include "client.h" #include "graphics.h" @@ -33,9 +32,11 @@ #include "utils/mathutils.h" #include "utils/physfsrwops.h" +#include "resources/dye.h" #include "resources/fboinfo.h" #include "resources/imagehelper.h" #include "resources/imagewriter.h" +#include "resources/openglimagehelper.h" #include "resources/resourcemanager.h" #include "debug.h" @@ -109,13 +110,28 @@ void AtlasManager::loadImages(const StringVect &files, resman->moveToDeleted(res); } - SDL_RWops *rw = PHYSFSRWOPS_openRead(str.c_str()); - Image *image = sdlImageHelper->load(rw); - if (image) + std::string path = str; + const size_t p = path.find('|'); + Dye *d = nullptr; + if (p != std::string::npos) + { + d = new Dye(path.substr(p + 1)); + path = path.substr(0, p); + } + + SDL_RWops *rw = PHYSFSRWOPS_openRead(path.c_str()); + if (rw) { - image->mIdPath = str; - images.push_back(image); + Image *image = d ? sdlImageHelper->load(rw, *d) + : sdlImageHelper->load(rw); + + if (image) + { + image->mIdPath = str; + images.push_back(image); + } } + delete d; } } -- cgit v1.2.3-70-g09d2