Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Turning sprite white/bright.  (Read 2125 times)

0 Members and 1 Guest are viewing this topic.

flugsten

  • Newbie
  • *
  • Posts: 1
    • View Profile
Turning sprite white/bright.
« 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.

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Turning sprite white/bright.
« Reply #1 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.
DSFML - SFML for the D Programming Language.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Turning sprite white/bright.
« Reply #2 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Turning sprite white/bright.
« Reply #3 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.
« Last Edit: May 02, 2014, 11:06:02 pm by Laurent »
Laurent Gomila - SFML developer

 

anything