SFML community forums
Help => Graphics => Topic started by: Sander on March 17, 2009, 04:57:00 pm
-
Hello,
I'm new to SFML and I've been playing around with it for a bit. I'm currently trying to create a pretty standard fade out effect; just fade to black. I've tried changing the opacity using Sprite.Color, but this isn't working. Here's my code;
Image img = new Image(640, 480, new Color(0,0,0, 0));
Sprite spr = new Sprite(img);
spr.Color = new Color(0, 0, 0, 100);
Window.Instance.Draw(spr);
Window.Instance.Display();
When drawn, the alpha isn't changed to 100; it's still 0.
So, what's the correct way to do what I'm trying? Thanks.
Edit: Oh, this is C# btw.
-
Your source image has an alpha value of 0. Whatever your sprite's color is, it will still be 0 (both are multiplicated to get the final component).
You should leave the alpha as 255 in the image, and only play with the sprite's color.
-
Awesome, got it. Thanks!