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/resourcemanager.cpp | |
parent | 1b1a7cea1c6b81438bacc86b93cb80a78430790f (diff) | |
download | mv-5994a6198ac35ea149a7211213dc296ee7406f44.tar.gz mv-5994a6198ac35ea149a7211213dc296ee7406f44.tar.bz2 mv-5994a6198ac35ea149a7211213dc296ee7406f44.tar.xz mv-5994a6198ac35ea149a7211213dc296ee7406f44.zip |
Move imageset load function from resourcemanager into separate file.
Diffstat (limited to 'src/resources/resourcemanager/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.cpp | 34 |
1 files changed, 0 insertions, 34 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; |