diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-25 20:48:35 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-25 20:48:35 +0300 |
commit | 5994a6198ac35ea149a7211213dc296ee7406f44 (patch) | |
tree | eec718594fd23da29f9d39e4c0fb00409d514a8e /src/resources/resourcemanager | |
parent | 1b1a7cea1c6b81438bacc86b93cb80a78430790f (diff) | |
download | manaplus-5994a6198ac35ea149a7211213dc296ee7406f44.tar.gz manaplus-5994a6198ac35ea149a7211213dc296ee7406f44.tar.bz2 manaplus-5994a6198ac35ea149a7211213dc296ee7406f44.tar.xz manaplus-5994a6198ac35ea149a7211213dc296ee7406f44.zip |
Move imageset load function from resourcemanager into separate file.
Diffstat (limited to 'src/resources/resourcemanager')
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.cpp | 34 | ||||
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.h | 7 |
2 files changed, 0 insertions, 41 deletions
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index aca30726b..2f32b7c71 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -527,40 +527,6 @@ Resource *ResourceManager::get(const std::string &idPath, return resource; } -struct ImageSetLoader final -{ - std::string path; - int w, h; - static Resource *load(const void *const v) - { - if (!v) - return nullptr; - - const ImageSetLoader *const - rl = static_cast<const ImageSetLoader *const>(v); - - Image *const img = Loader::getImage(rl->path); - if (!img) - { - reportAlways("Image loading error: %s", rl->path.c_str()); - return nullptr; - } - ImageSet *const res = new ImageSet(img, rl->w, rl->h); - img->decRef(); - return res; - } -}; - -ImageSet *ResourceManager::getImageSet(const std::string &imagePath, - const int w, const int h) -{ - ImageSetLoader rl = { imagePath, w, h }; - std::stringstream ss; - ss << imagePath << "[" << w << "x" << h << "]"; - return static_cast<ImageSet*>(get(ss.str(), ImageSetLoader::load, &rl)); -} - - struct SubImageSetLoader final { ResourceManager *manager; diff --git a/src/resources/resourcemanager/resourcemanager.h b/src/resources/resourcemanager/resourcemanager.h index 13c99df63..2c54aeb5a 100644 --- a/src/resources/resourcemanager/resourcemanager.h +++ b/src/resources/resourcemanager/resourcemanager.h @@ -133,13 +133,6 @@ class ResourceManager final : public MemoryCounter */ bool addResource(const std::string &idPath, Resource *const resource); - /** - * Creates a image set based on the image referenced by the given - * path and the supplied sprite sizes - */ - ImageSet *getImageSet(const std::string &imagePath, - const int w, const int h) A_WARN_UNUSED; - ImageSet *getSubImageSet(Image *const parent, const int width, const int height) A_WARN_UNUSED; |