Uh-oh

Hit a massive snag with sprite-loading. We’re using transparent PNG spritesheets. For, say, the font, the SDL_Surface* _font is loaded, and displays as transparent with no problems.

When blitting parts of _font onto an empty SDL surface, there is no transparency:
SDL_Surface *surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, width, height, 32,0xff000000,0x00ff0000,0x0000ff00,0);

SDL_BlitSurface(_font, &srcRect, surface, &destRect);
results in:

I’ve tried every combination of masks imaginable, including _font->format->Rmask, etc., to no effect.

If anyone has any idea what I’m doing wrong, I’d love to know, even though we’re very unlikely to make the jam deadline at this point.

Comments

JohnBedlam
18. Dec 2011 · 16:49 UTC
I had the exact same problem. It has to do with alpha channels being applied instead of blitted or something.