SDL_BlitSurface problem

Hello.

I am trying to SDL_BlitSurface from one surface to another (which is not
screen) and it doesn’t seem to work.

Here are some part of the code :------
SDL_Surface *newsprite2;
Uint32 rmask, gmask, bmask, amask;

#if SDL_BYTEORDER == SDL_BIG_ENDIAN
rmask = 0xff000000;
gmask = 0x00ff0000;
bmask = 0x0000ff00;
amask = 0x000000ff;
#else
rmask = 0x000000ff;
gmask = 0x0000ff00;
bmask = 0x00ff0000;
amask = 0xff000000;
#endif

newsprite2 = SDL_CreateRGBSurface(SDL_SWSURFACE, FONT_W, FONT_H, SCREEN_BPP, rmask, gmask, bmask, amask);


dst2.x=0;dst2.y=0;
SDL_BlitSurface(spriteimage,sprites[i],newsprite2,&dst2);
SDL_Flip(newsprite2);

if I blitsurface to the screen it works, but not to newsprite2, am I
doing something wrong here ?


Fabien Penso

Sat, 13 Mar 2004 12:58:00 +0100, tu as dit :

Hello.
I am trying to SDL_BlitSurface from one surface to another (which is not
screen) and it doesn’t seem to work.

[…]

Thanks to Jon, fixed it on IRC. Just set amask to zero…

Fabien Penso wrote:

SDL_BlitSurface(spriteimage,sprites[i],newsprite2,&dst2);
SDL_Flip(newsprite2);

You’ll also want to remove the SDL_Flip. It’s only useful on the screen
surface.

Stephane