From: Jarda B. <edh...@us...> - 2004-06-27 23:47:36
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/SDLVideo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2888/plugins/SDLVideo Modified Files: SDLVideoDriver.h SDLVideoDriver.cpp Log Message: Ignore mouse events on transparent parts of buttons (non-rectangular buttons now work correctly) Index: SDLVideoDriver.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/SDLVideo/SDLVideoDriver.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** SDLVideoDriver.h 29 May 2004 11:15:30 -0000 1.32 --- SDLVideoDriver.h 27 Jun 2004 23:47:26 -0000 1.33 *************** *** 122,125 **** --- 122,126 ---- public: + bool IsSpritePixelTransparent (Sprite2D* sprite, short x, short y); void release(void) { Index: SDLVideoDriver.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** SDLVideoDriver.cpp 27 Jun 2004 19:30:06 -0000 1.71 --- SDLVideoDriver.cpp 27 Jun 2004 23:47:26 -0000 1.72 *************** *** 1044,1047 **** --- 1044,1064 ---- } + bool SDLVideoDriver::IsSpritePixelTransparent(Sprite2D* sprite, short x, short y) + { + SDL_Surface *surf = (SDL_Surface*)(sprite->vptr); + Color color; + + unsigned char * pixels = ( ( unsigned char * ) surf->pixels ) + + ( ( y * surf->w + x) * surf->format->BytesPerPixel ); + long val = 0; + SDL_LockSurface( surf ); + memcpy( &val, pixels, surf->format->BytesPerPixel ); + SDL_UnlockSurface( surf ); + + //SDL_GetRGBA( val, surf->format, &color.r, &color.g, &color.b, &color.a ); + //return color.a == 0; + return val == 0; + } + /* * Draws horizontal line. When clipped=true, it draws the line relative |