From: Jarda B. <edh...@us...> - 2005-06-05 23:57:27
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/SDLVideo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26416/gemrb/plugins/SDLVideo Modified Files: SDLVideoDriver.cpp SDLVideoDriver.h Log Message: mplemented preliminary fog-of-war on the minimaps Index: SDLVideoDriver.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/SDLVideo/SDLVideoDriver.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** SDLVideoDriver.h 19 May 2005 14:56:20 -0000 1.48 --- SDLVideoDriver.h 5 Jun 2005 23:57:14 -0000 1.49 *************** *** 80,83 **** --- 80,84 ---- /** This function Draws the Border of a Rectangle as described by the Region parameter. The Color used to draw the rectangle is passes via the Color parameter. */ void DrawRect(Region& rgn, Color& color, bool fill = true, bool clipped = false); + void DrawRectSprite(Region& rgn, Color& color, Sprite2D* sprite, bool fill = true, bool clipped = false); /** This functions Draws a Circle */ void DrawCircle(short cx, short cy, unsigned short r, Color& color); Index: SDLVideoDriver.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** SDLVideoDriver.cpp 19 May 2005 14:56:19 -0000 1.104 --- SDLVideoDriver.cpp 5 Jun 2005 23:57:14 -0000 1.105 *************** *** 754,757 **** --- 754,783 ---- } } + + /** This function Draws the Border of a Rectangle as described by the Region parameter. The Color used to draw the rectangle is passes via the Color parameter. */ + void SDLVideoDriver::DrawRectSprite(Region& rgn, Color& color, Sprite2D* sprite, bool fill, bool clipped) + { + SDL_Surface* surf = ( SDL_Surface* ) sprite->vptr; + SDL_Rect drect = { + rgn.x, rgn.y, rgn.w, rgn.h + }; + if ( SDL_ALPHA_TRANSPARENT == color.a ) { + return; + } else if ( SDL_ALPHA_OPAQUE == color.a ) { + long val = SDL_MapRGBA( surf->format, color.r, color.g, color.b, color.a ); + SDL_FillRect( surf, &drect, val ); + } else { + SDL_Surface * rectsurf = SDL_CreateRGBSurface( SDL_HWSURFACE | SDL_SRCALPHA, rgn.w, rgn.h, 8, 0, 0, 0, 0 ); + SDL_Color c; + c.r = color.r; + c.b = color.b; + c.g = color.g; + SDL_SetPalette( rectsurf, SDL_LOGPAL, &c, 0, 1 ); + SDL_SetAlpha( rectsurf, SDL_SRCALPHA | SDL_RLEACCEL, color.a ); + SDL_BlitSurface( rectsurf, NULL, surf, &drect ); + SDL_FreeSurface( rectsurf ); + } + } + void SDLVideoDriver::SetPixel(short x, short y, Color& color, bool clipped) { |