From: Daniel Karbach Date: Tue, 7 Aug 2012 14:06:35 +0000 (+0200) Subject: added ugly fallback for missing sprite surfaces X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=4083783e857cd6f039af2faaef43a30788948a6b;hp=bfcf2f4de43077249b82af03a0e1b8281b8490e3;p=l2e.git added ugly fallback for missing sprite surfaces --- diff --git a/src/graphics/Sprite.cpp b/src/graphics/Sprite.cpp index afd6209..5b974bd 100644 --- a/src/graphics/Sprite.cpp +++ b/src/graphics/Sprite.cpp @@ -21,7 +21,19 @@ void Sprite::Draw(SDL_Surface *dest, Point 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; + } + } } }