00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef IMAGE_MANAGER_H_
00021 #define IMAGE_MANAGER_H_
00022
00023 #include "../Config.h"
00024
00025 #include "GraphicsDebug.h"
00026 #include "../Util/GeneralException.h"
00027
00028 #include "SDL.h"
00029
00030 #include <string>
00031 #include <vector>
00032 #include <map>
00033
00034 using namespace std;
00035
00036 namespace Graphics {
00037
00055 class ImageManager {
00056 public:
00062 SDL_Surface* getImage(const string& str);
00063
00066 static ImageManager* getInstance();
00067
00071 static void destroy();
00072
00074 void freeAll();
00075
00077 void freeBMP(const string& str);
00078
00080 void freeBMP(SDL_Surface* surf);
00081
00082 ~ImageManager();
00083 private:
00084 static ImageManager* instance;
00085
00086 typedef map<string,SDL_Surface*> mapStrSurf;
00087 mapStrSurf nameReferenceTable;
00088
00089 void removeFromTable(mapStrSurf::iterator &i);
00090
00091 ImageManager();
00092
00093 #ifdef DEBUG_GRAPHICS_IMAGE_MANAGER
00094 public:
00095 void debugPrintPairs();
00096 #endif
00097 };
00098 };
00099
00100 #endif // ifndef IMAGE_MANAGER_H_
00101