SFML / CSFML

Official binding of SFML for C
https://www.sfml-dev.org
Other
342 stars 121 forks source link

what happen to sfRenderWindow_capture? #260

Closed jarroddavis68 closed 2 months ago

jarroddavis68 commented 2 months ago

did it go away? How, now to reproduce the functionality? Do I have to drop down to opengl now?

Marioalexsan commented 2 months ago

It's deprecated, the alternative is listed in the documentation:

Use a sfTexture and its sfTexture_updateFromRenderWindow(sfTexture, const sfRenderWindow, unsigned int, unsigned int) function and copy its contents into an sfImage instead.

jarroddavis68 commented 2 months ago

ahh, many thanks. I im in the process of converting codebase over to 3.0 and noticed it was gone. Ok, thanks again.

eXpl0it3r commented 2 months ago

capture has been deprecated for a while and was/will be removed in SFML 3.

Use a sf::Texture and its sf::Texture::update(const Window&) function and copy its contents into an sf::Image instead.

sf::Vector2u windowSize = window.getSize();
sf::Texture texture;
texture.create(windowSize.x, windowSize.y);
texture.update(window);
sf::Image screenshot = texture.copyToImage()

https://www.sfml-dev.org/documentation/2.6.1/classsf_1_1RenderWindow.php#a5a784b8a09bf4a8bc97ef9e0a8957c35