diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-20 00:34:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-21 00:59:10 +0300 |
commit | aa68511ad3d339be8c8f42fc6c083b696d8e687b (patch) | |
tree | 1bf138439c28b4a879c6b35e4361801bd5e1d246 /src/resources/resourcemanager.h | |
parent | 12002b81544038bc5855189c74aca761d0c08f1b (diff) | |
download | plus-aa68511ad3d339be8c8f42fc6c083b696d8e687b.tar.gz plus-aa68511ad3d339be8c8f42fc6c083b696d8e687b.tar.bz2 plus-aa68511ad3d339be8c8f42fc6c083b696d8e687b.tar.xz plus-aa68511ad3d339be8c8f42fc6c083b696d8e687b.zip |
Add delayed images load.
Can work for now only in OpenGL modes.
Diffstat (limited to 'src/resources/resourcemanager.h')
-rw-r--r-- | src/resources/resourcemanager.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index ca6bdb373..4900b7ce3 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -28,9 +28,11 @@ #include "utils/stringvector.h" #include <ctime> +#include <list> #include <map> #include <set> +class AnimationDelayLoad; class Image; class ImageSet; class Music; @@ -41,6 +43,9 @@ class SpriteDef; struct SDL_Surface; struct SDL_RWops; +typedef std::list<AnimationDelayLoad*> DelayedAnim; +typedef DelayedAnim::iterator DelayedAnimIter; + /** * A class for loading and managing resources. */ @@ -139,6 +144,10 @@ class ResourceManager */ Resource *get(const std::string &idPath, generator fun, void *data); + Resource *getFromCache(const std::string &idPath); + + Resource *getFromCache(const std::string &filename, int variant); + /** * Loads a resource from a file and adds it to the resource map. * @@ -269,13 +278,19 @@ class ResourceManager void cleanOrphans(bool always = false); + static void addDelayedAnimation(AnimationDelayLoad *animation) + { mDelayedAnimations.push_back(animation); } + + static void delayedLoad(); + + static void removeDelayLoad(AnimationDelayLoad *delayedLoad); + private: /** * Deletes the resource after logging a cleanup message. */ static void cleanUp(Resource *resource); - static ResourceManager *instance; std::set<SDL_Surface*> deletedSurfaces; Resources mResources; @@ -284,6 +299,7 @@ class ResourceManager std::string mSelectedSkin; std::string mSkinName; bool mDestruction; + static DelayedAnim mDelayedAnimations; }; #endif |