diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-24 23:43:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-24 23:49:11 +0300 |
commit | 59271755dc75f5de6c288308df92f687deaa32b4 (patch) | |
tree | 3be45c4fde11ee189c25ae69d52a661af096cb99 /src/resources/resourcemanager/resourcemanager.cpp | |
parent | d0a3a9f0f6dd3571e9f3a15bf4f8493a46d69eef (diff) | |
download | plus-59271755dc75f5de6c288308df92f687deaa32b4.tar.gz plus-59271755dc75f5de6c288308df92f687deaa32b4.tar.bz2 plus-59271755dc75f5de6c288308df92f687deaa32b4.tar.xz plus-59271755dc75f5de6c288308df92f687deaa32b4.zip |
Move music load functions from resourcemanager into separate file.
Diffstat (limited to 'src/resources/resourcemanager/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index c59b09618..abec23475 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -527,42 +527,6 @@ Resource *ResourceManager::get(const std::string &idPath, return resource; } -struct ResourceLoader final -{ - ResourceManager *manager; - std::string path; - ResourceManager::loader fun; - - static Resource *load(const void *const v) - { - if (!v) - return nullptr; - const ResourceLoader *const - rl = static_cast<const ResourceLoader *const>(v); - SDL_RWops *const rw = MPHYSFSRWOPS_openRead(rl->path.c_str()); - if (!rw) - { - reportAlways("Error loading resource: %s", - rl->path.c_str()); - return nullptr; - } - Resource *const res = rl->fun(rw, rl->path); - return res; - } -}; - -SDLMusic *ResourceManager::getMusic(const std::string &idPath) -{ - ResourceLoader rl = { this, idPath, &SDLMusic::load }; - return static_cast<SDLMusic*>(get(idPath, ResourceLoader::load, &rl)); -} - -SoundEffect *ResourceManager::getSoundEffect(const std::string &idPath) -{ - ResourceLoader rl = { this, idPath, &SoundEffect::load }; - return static_cast<SoundEffect*>(get(idPath, ResourceLoader::load, &rl)); -} - struct DyedImageLoader final { ResourceManager *manager; |