From 4083783e857cd6f039af2faaef43a30788948a6b Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Tue, 7 Aug 2012 16:06:35 +0200 Subject: [PATCH] added ugly fallback for missing sprite surfaces --- src/graphics/Sprite.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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; + } + } } } -- 2.39.2