[Super-tux-commit] supertux/src texture.cpp,1.21,1.22
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-05-09 01:13:29
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24748/src Modified Files: texture.cpp Log Message: SDL draw() now supports alpha blitting. Index: texture.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/texture.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- texture.cpp 5 May 2004 22:04:48 -0000 1.21 +++ texture.cpp 9 May 2004 01:13:20 -0000 1.22 @@ -652,16 +652,38 @@ if(alpha != 255) { /* Copy the SDL surface, then make it using alpha and use it to blit into the screen */ +/* SDL_Surface* sdl_surface_copy = SDL_CreateRGBSurface (sdl_surface->flags, sdl_surface->w, sdl_surface->h, sdl_surface->format->BitsPerPixel, - sdl_surface->format->Rmask, sdl_surface->format->Gmask, sdl_surface->format->Bmask, + sdl_surface->format->Rmask, sdl_surface->format->Gmask, + sdl_surface->format->Bmask, sdl_surface->format->Amask); SDL_BlitSurface(sdl_surface, NULL, sdl_surface_copy, NULL); SDL_SetAlpha(sdl_surface_copy ,SDL_SRCALPHA,alpha); - int ret = SDL_BlitSurface(sdl_surface_copy, NULL, screen, &dest); + int ret = SDL_BlitSurface(sdl_surface_copy, NULL, screen, &dest); */ + +/* *TEST* Create a Surface, make it using colorkey, blit surface into temp, apply alpha +to temp sur, blit the temp into the screen */ + + SDL_Surface* sdl_surface_copy = SDL_CreateRGBSurface (sdl_surface->flags, + sdl_surface->w, sdl_surface->h, sdl_surface->format->BitsPerPixel, + sdl_surface->format->Rmask, sdl_surface->format->Gmask, + sdl_surface->format->Bmask, + 0); +int colorkey = SDL_MapRGB(sdl_surface_copy->format, 255, 0, 255); +SDL_FillRect(sdl_surface_copy, NULL, colorkey); +SDL_SetColorKey(sdl_surface_copy, SDL_SRCCOLORKEY, colorkey); + + +SDL_BlitSurface(sdl_surface, NULL, sdl_surface_copy, NULL); +SDL_SetAlpha(sdl_surface_copy ,SDL_SRCALPHA,alpha); + +int ret = SDL_BlitSurface(sdl_surface_copy, NULL, screen, &dest); + + if (update == UPDATE) SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h); |