Problem with Alpha on Fullscreen

Hi there,

I am having a problem with blitting an alpha blended surface onto my
main screen surface when i am in the fullscreen mode.
The surface is visible for a split second, then it vanishes, however, it
is still being blitted.
I do not encounter this problem in a windowed mode.

Firstly, the screen surface (which the sprites are blitted to) is
created like :

Secondly, the surface i am setting the alpha on is being made via :

if((temp = SDL_LoadBMP(filename)) == NULL) {printf(“File:%s not
found\n”,filename);return -1;};
SDL_SetColorKey(temp, SDL_SRCCOLORKEY, SDL_MapRGB(temp->format, 0,
255, 0));
if (color_specify==1) {
SDL_SetColorKey(temp, SDL_SRCCOLORKEY, SDL_MapRGB(temp->format, r,
g, b));
mAnim[count].image = SDL_DisplayFormat(temp);
SDL_SetAlpha(mAnim[count].image, SDL_SRCALPHA, a); // <–
Removing this call makes the sprite visible, but no alpha blending

(r,g,b is an int. a is a Uint8. Filename is a *char)

Basically, all the frames of a sprite are loaded into a CSpriteBase.
The CSpriteBase is used in a CSprite to draw the frames.

A CSprite blits the sprite frame via this code :

void CSprite::draw()
if (!used) return;
if(mAnimating == 1)
if(mFrame>mFinish) mFrame=mStart;
if (mFrame>mSpriteBase->mNumframes-1) mFrame=mStart;
mLastupdate = SDL_GetTicks();

if(mDrawn==0) mDrawn=1;

SDL_Rect dest;
dest.x = mX; dest.y = mY;
SDL_BlitSurface(mSpriteBase->mAnim[mFrame].image, NULL, mScreen, &dest);

Anyone know whats going wrong?

This is fixed in CVS, thanks to John Popplewell. :slight_smile:

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment