Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.53 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SDL Color Key Can i get the color of an image background?
  2. if( loadedImage != NULL )
  3.     {
  4.         //Create an optimized image
  5.         optimizedImage = SDL_DisplayFormat( loadedImage );
  6.  
  7.         //Free the old image
  8.         SDL_FreeSurface( loadedImage );
  9.  
  10.         //If the image was optimized just fine
  11.         if( optimizedImage != NULL )
  12.         {
  13.             Uint32 colorkey = SDL_MapRGB( optimizedImage->format, 0xFF, 0xFF, 0xFF );
  14.  
  15.             SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);
  16.         }
  17.     }