Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBaneTrapper

Posted 22 October 2012 - 02:37 PM

Hello.
What i am trying to do is draw "Hero.png" 50x50 image to screen.
Problem is that i don't know how to ignore one color, so it does not draw a square of pink(color i use for background on "Hero.png" around my character. Therefore make the (255,0,255) color transparent on my sprite.

I cant find a function to do this in sfml.

in SDL the function is something like
//Set all pixels of color R 0, G 0xFF, B 0xFF to be transparent
//SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, colorkey );

//int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key); This is definition

SDL_SetColorKey(MyImage,
SDL_SRCCOLORKEY,
SDL_MapRGB(Screen->format, 255, 0, 255);


#4BaneTrapper

Posted 22 October 2012 - 02:36 PM

Hello.
What i am trying to do is draw "Hero.png" 50x50 image to screen.
Problem is that i don't know how to ignore one color, so it does not draw a square of pink(color i use for background on "Hero.png" around my character. Therefore make the (255,0,255) color transparent on my sprite.

I cant find a function to do this in sfml.

in SDL the function is something like
//Set all pixels of color R 0, G 0xFF, B 0xFF to be transparent
//SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, colorkey );

SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
SDL_SetColorKey(MyImage,
SDL_SRCCOLORKEY,
SDL_MapRGB(Screen->format, 255, 0, 255);


#3BaneTrapper

Posted 22 October 2012 - 02:36 PM

Hello.
What i am trying to do is draw "Hero.png" 50x50 image to screen.
Problem is that i don't know how to ignore one color, so it does not draw a square of pink(color i use for background on "Hero.png" around my character. Therefore make the (255,0,255) color transparent on my sprite.

I cant find a function to do this in sfml.

in SDL the function is something like
//Set all pixels of color R 0, G 0xFF, B 0xFF to be transparent
//SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, colorkey );
SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
SDL_SetColorKey(MyImage,
SDL_SRCCOLORKEY,
SDL_MapRGB(Screen->format, 255, 0, 255);

#2BaneTrapper

Posted 22 October 2012 - 02:36 PM

Hello.
What i am trying to do is draw "Hero.png" 50x50 image to screen.
Problem is that i don't know how to ignore one color, so it does not draw a square of pink(color i use for background on "Hero.png" around my character. Therefore make the (255,0,255) color transparent on my sprite.

I cant find a function to do this in sfml.

in SDL the function is something like
//Set all pixels of color R 0, G 0xFF, B 0xFF to be transparent
//SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, colorkey );
SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
SDL_SetColorKey(MyImage,
 SDL_SRCCOLORKEY,
SDL_MapRGB(Screen->format, 255, 0, 255);

#1BaneTrapper

Posted 22 October 2012 - 02:28 PM

Hello.
What i am trying to do is draw "Hero.png" 50x50 image to screen.
Problem is that i don't know how to ignore one color, so it does not draw a square of pink(color i use for background on "Hero.png" around my character. Therefore make the (255,0,255) color transparent on my sprite.

I cant find a function to do this in sfml.

in SDL the function is something like
//Set all pixels of color R 0, G 0xFF, B 0xFF to be transparent
SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, colorkey );

PARTNERS