Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

BioSquirrel

Transparent Bitmaps (SDL)

This topic is 5734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

To make the bitmap ''swat1up'' have transparency on its white pixels, I put: int SDL_SetColorKey(SDL_Surface *swat1up, SDL_SRCCOLORKEY, 0, 0, 0); I get error C2059: syntax error : ''constant''

Share this post


Link to post
Share on other sites
Advertisement
error C2501: ''SDL_SetColorKey'' : missing storage-class or type specifiers

error C2373: ''SDL_SetColorKey'' : redefinition; different type modifiers

c:\unzipped\sdl-devel-1.2.3-vc6[1]\sdl-1.2.3\include\sdl_video.h(567) : see declaration of ''SDL_SetColorKey''

error C2078: too many initializers

Share this post


Link to post
Share on other sites
quote:
Original post by BioSquirrel
int SDL_SetColorKey(SDL_Surface *swat1up, SDL_SRCCOLORKEY, 0, 0, 0);


You're declaring a function prototype here: almost certainly not what you want. The format should be:

SDL_SetColorKey(swat1up, SDL_SRCCOLORKEY, 0, 0, 0);

It's just a function call, after all. But also see what Ronin posted above. Or use my little function here:

inline int SDL_SetNativeColorKey(SDL_Surface* const in, int flags, Uint8 r, Uint8 g, Uint8 b)
{
return SDL_SetColorKey(in, flags|SDL_SRCCOLORKEY, SDL_MapRGB(in->format, r, g, b));
}


[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]

[edited by - Kylotan on December 4, 2002 8:31:35 PM]

Share this post


Link to post
Share on other sites
Are you sure that all the pixels you want transparent are absolutely RGB(255,255,255)? Transparency will not work if any of the color values of the pixel are off by even 1 unit.

After the transparency is set, simply calling SDL_BlitSurface with the transparent surface as before should work fine.

http://roninmagus.hopto.org
acronymfinder.com - Find any acronym you need!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!