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

Author Topic: Changing the color of a part of a sprite  (Read 1265 times)

0 Members and 1 Guest are viewing this topic.

Bogdan

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Changing the color of a part of a sprite
« on: August 19, 2017, 08:32:34 am »
Hi,
is it possible to change the color of a part of a sprite only?
Let's assume that I've got a sprite consisting of a greyscale building and a colored symbol.
How to change the color of the building only (lets say to red), while keeping the original symbol color?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10838
    • View Profile
    • development blog
    • Email
Re: Changing the color of a part of a sprite
« Reply #1 on: August 19, 2017, 10:27:47 am »
Space them further apart and use two sprites with different texture rects. Then you can change the color of each sprite independently.
A sprite by itself can't have multiple colors.

If that's how you always want to display it, then the better solution would be to use a image editor abd change the color there.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/