00001 #ifndef DEF_IMGCACHE_H 00002 #define DEF_IMGCACHE_H 1 00003 00009 class ImageCache { 00010 public: 00011 ImageCache(); 00012 ~ImageCache(); 00016 00017 Image& loadImage(std::vector<SDL_Rect> image_desc, string imagename, double scale_factor=1); 00018 Image& loadImage(string imagename, double scale_factor=1, string image_desc_file=""); 00019 Image& loadImage(Uint16 num_frames, string imagename, double scale_factor=1); 00020 Image& loadImage(Uint16 width, Uint16 shift, string imagename, double scale_factor=1); 00021 Image& loadImage(SDL_Rect base_rect, string imagename, double scale_factor=1); 00023 private: 00024 std::map<pair<string,double>,Image> imgcache; 00025 string not_found; 00026 private: 00027 SDL_Rect& scaleRectangle(SDL_Rect& base_rect, double scale_factor); 00028 std::vector<SDL_Rect>& scaleDescription(std::vector<SDL_Rect>& description, double scale_factor); 00029 Image& scaleImage(Image& original_image, double scale_factor); 00030 }; 00031 00032 #endif