Been trying to create a fading effect, made a separate class for it, everything works fine, except not really. The basic idea was to draw a RectangleShape across the whole screen with a black fillcolor, and an alpha of 0, then the class gradually increases it over a period of time. When I run the thing, that period of time is noticeable, so the class does what it is supposed to do, except I don't see the rectangleshape at all, even though it is being drawn, it is transparent during the whole thing. Tried to do it just within the loop as well, without the class, the issue is the same.
Without class version:
Clock clock;
RectangleShape fade;
fade.setPosition(Vector2f(0,0));
fade.setFillColor(Color(0,0,0,0));
fade.setSize(Vector2f(800,600));
int i=0;
while (window.isOpen())
{
if(clock.getElapsedTime()>seconds(0.04)){
i++;
fade.setFillColor(Color(0,0,0,i));
clock.restart();
}
///other stuff
window.draw(fade);
}
Am I just not supposed to be doing this with a RectangleShape?