SFML community forums

Help => Graphics => Topic started by: flugsten on May 02, 2014, 09:39:04 pm

Title: Turning sprite white/bright.
Post by: flugsten on May 02, 2014, 09:39:04 pm
I am attempting to turn my player character whiter/brighter for a short while after taking damage and to turn buttons white on hover, however as the sprite color defaults to white I struggle doing so. Is there any easy way to make a sprite whiter? Thanks in advance.
Title: Re: Turning sprite white/bright.
Post by: Jebbs on May 02, 2014, 10:12:38 pm
One solution that comes to mind would be to use a shader. I'm not sure if there's  an easier or better solution than that,  though.
Title: Re: Turning sprite white/bright.
Post by: eXpl0it3r on May 02, 2014, 10:33:09 pm
You could potentially start with a grey color applied to your sprite, thus you can make it whiter later on.
Title: Re: Turning sprite white/bright.
Post by: Laurent on May 02, 2014, 11:04:30 pm
Draw a white version (either prepared outside the program, or built programmatically) of your sprite on top of the sprite itself, with sf::BlendAlpha blend mode. Adjust the sprite's opacity to your needs.

You can play with blend modes to find the perfect result. Note that the current development version has more blending options than the latest release.