Skip to main content

News

Topic: Replace color in-game (Read 4022 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
Replace color in-game
Is it possible to change a color of an image in-game? Like, this PNG image which is all green, I want to change the green to white transparent. I cant seem to see any function of that sort in the functions list..

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Replace color in-game
Reply #1
Cast an image to a surface with image.createSurface(). Then use surface.replaceColors(Col_A, Col_B). And finally cast it back with surface.createImage().
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here