diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-17 22:10:32 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-17 22:10:32 +0000 |
commit | 5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378 (patch) | |
tree | 1fb09db60c300ccf480796b73eeaf50454ab16e9 /src/resources/image.cpp | |
parent | cf4a6be42ce03dde0caea52032f0403f3f96781a (diff) | |
download | mana-client-5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378.tar.gz mana-client-5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378.tar.bz2 mana-client-5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378.tar.xz mana-client-5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378.zip |
Loaded images now converted to display format for speed, and added support
for masking on magic pink.
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r-- | src/resources/image.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp index f3af2790..624036cf 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -25,6 +25,7 @@ #include "image.h" #include <iostream> #include <SDL_image.h> +#include "../graphic/graphic.h" Image::Image(SDL_Surface *image): image(image) @@ -42,7 +43,12 @@ Image* Image::load(const std::string &filePath) std::cout << "Image::load(" << filePath << ")\n"; #endif // Attempt to use SDL_Image to load the file. - SDL_Surface *image = IMG_Load(filePath.c_str()); + SDL_Surface *tmpImage = IMG_Load(filePath.c_str()); + SDL_Surface *image = SDL_ConvertSurface( + tmpImage, screen->format, SDL_SWSURFACE); + SDL_FreeSurface(tmpImage); + SDL_SetColorKey(image, SDL_SRCCOLORKEY | SDL_RLEACCEL, + SDL_MapRGB(image->format, 255, 0, 255)); // Check if the file was opened and return the appropriate value. if (!image) { |