hi
i’ve just recently started to program with SDL so i don’t really know much about it
although i can do most of the things i like, i can’t create a semi-transparent box above the
scene of my game
i recon i should create a new surface and blit it onto the scene surface.
well, this is just a guess
Yep. That’s one way.
i tried to do this, but without success.
can someone tell me how exactly this works?
I created a black surface:
black_surf = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA,
width, height,
screen->format->BitsPerPixel,
screen->format->Rmask,
screen->format->Gmask,
screen->format->Bmask,
screen->format->Amask);
(where “screen” was: “screen = SDL_SetVideomode(w, h, 16, 0);”, for example)
Then I filled it with black:
SDL_FillRect(black_surf, NULL, SDL_MapRGB(black_surf->format, 0, 0, 0));
Then, I can blit it with varying degrees of transparency/opacity:
SDL_SetAlpha(black_surf, SDL_SRCALPHA, some_number);
SDL_BlitSurface(black_surf, …, screen, …);
That’s one way… Dunno if it’s very good/fast, though.
Good luck!On Wed, May 07, 2003 at 10:20:30PM +0200, wim wrote:
–
bill at newbreedsoftware.com Hire me!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/bill/resume/