diff options
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index c63b626e..00e4726e 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -533,3 +533,18 @@ SDL_Surface *ResourceManager::loadSDLSurface(const std::string &filename) return tmp; } + +void ResourceManager::scheduleDelete(SDL_Surface* surface) +{ + mDeletedSurfaces.insert(surface); +} + +void ResourceManager::clearScheduled() +{ + for (std::set<SDL_Surface*>::iterator i = mDeletedSurfaces.begin(), + i_end = mDeletedSurfaces.end(); i != i_end; ++i) + { + SDL_FreeSurface(*i); + } + mDeletedSurfaces.clear(); +} |