0

it comes down to this code:

SDL_Surface *smiley = SDL_LoadBMP("./images/smileys/normal_up.bmp");
printf("Transparation worked: %i\n", SDL_SetColorKey(smiley, SDL_SRCCOLORKEY, SDL_MapRGB(smiley->format, 255, 0, 255)));
SDL_BlitSurface(smiley, NULL, window, NULL);
SDL_Flip(window);

This is the image I used. Using SDL on Arch Linux.

4

1 回答 1

0

在 SDL_SetColorKey() 调用之前的这些行使整个工作正常:

smiley->format->Amask = 0xFF000000;
smiley->format->Ashift = 24;

现在我可以使用具有 32 或 24 bpp VideoMode 的 .bmp 或 .jpg 文件,一切正常!不知道为什么,不知道它是如何工作的。

于 2013-02-08T11:28:13.207 回答