SFML community forums
Help => Graphics => Topic started by: krisando on July 10, 2011, 10:22:42 am
-
I'm using the RenderImage class due to the surface like nature of it. Also am unsure whether this is a bug or misuse.
I create the image like so:
sf::RenderImage surface;
surface.Create(512, 512);
And believe the clear function can take:
sf::Color(255, 0, 0, 255)
sf::Color::Red
...
Red looks like a preset copy of the latter. You can see I'm testing this by making the image completely red.
surface.Clear(sf::Color(0, 255, 0, 255));
window.Draw(surface);
The result is a 512x512 black block.
Then I thought maybe it will clear the area in the view, not sure if the 2.0 documentation is outdated with this class but I tried this:
sf::View view;
view.Reset(sf::FloatRect(100, 100, 400, 200));
sf::RenderImage surface;
surface.SetView(surface); //No function in class SetView()
Am I going about clearing the RenderImage with a specific colour?
Kris
-
Try this:
surface.Clear(sf::Color::Red);
surface.Display();
window.Draw(sf::Sprite(surface));
The documentation is not outdated, the SetView function is in the RenderTarget base class.