]> git.localhorst.tv Git - l2e.git/commitdiff
added ugly fallback for missing sprite surfaces
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 7 Aug 2012 14:06:35 +0000 (16:06 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 7 Aug 2012 14:06:35 +0000 (16:06 +0200)
src/graphics/Sprite.cpp

index afd6209546c3a6bdcb8f359f43e89dd8c75ec8c5..5b974bd3817ed3ed97b89c1879fc0595ec80b78f 100644 (file)
@@ -21,7 +21,19 @@ void Sprite::Draw(SDL_Surface *dest, Point<int> position, int col, int row) cons
        destRect.y = position.Y();
        destRect.w = Width();
        destRect.h = Height();
-       SDL_BlitSurface(surface, &srcRect, dest, &destRect);
+       if (surface) {
+               SDL_BlitSurface(surface, &srcRect, dest, &destRect);
+       } else {
+               bool red(true);
+               while (destRect.w > 1 && destRect.h > 1) {
+                       SDL_FillRect(dest, &destRect, SDL_MapRGB(dest->format, red ? 0xFF : 0, 0, 0));
+                       ++destRect.x;
+                       ++destRect.y;
+                       destRect.w -= 2;
+                       destRect.h -= 2;
+                       red = !red;
+               }
+       }
 }
 
 }