summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-03 13:01:51 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-03 13:01:51 +0300
commit42411c8963eec06448a5dbf565add0540d6987f1 (patch)
treef20ba67a2a6dba1b49c0292f680cb6a214708da7 /src/resources
parent22dfbaa64b8c3c38de632f1d9325bd6d0e7d0cd1 (diff)
downloadManaVerse-42411c8963eec06448a5dbf565add0540d6987f1.tar.gz
ManaVerse-42411c8963eec06448a5dbf565add0540d6987f1.tar.bz2
ManaVerse-42411c8963eec06448a5dbf565add0540d6987f1.tar.xz
ManaVerse-42411c8963eec06448a5dbf565add0540d6987f1.zip
Add support for dye in atlasmanager.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/atlasmanager.cpp28
1 files changed, 22 insertions, 6 deletions
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;
}
}