SFML community forums

Help => Graphics => Topic started by: TwoOfDiamonds on July 27, 2012, 04:32:50 pm

Title: SFML 2 RenderWindow::capture
Post by: TwoOfDiamonds on July 27, 2012, 04:32:50 pm
Hey everyone !
So ... I got this code :
sf::Image Screenshot ;
Screenshot = Window.capture() ;
Screenshot.saveToFile ("screenshot.jpg") ;

and for some reason it won't save my image . Can you point me in the right direction please?

Note : I'm using SFML 2 amd Code::Blocks
Title: Re: SFML 2 RenderWindow::capture
Post by: thePyro_13 on July 27, 2012, 04:52:26 pm
How does it "won't save your image"? Does it give an error, is anything printed to the console, or does it run fine except the image isn't saved in the location you expected it to be in?
Title: Re: SFML 2 RenderWindow::capture
Post by: eXpl0it3r on July 27, 2012, 07:08:06 pm
The sprite will be saved into the working directory of your application, check your Code::Blocks settings for this. Also make sure you got the rights to write to that directory (no admin rights needed, etc...). ;)
And as thePyro_13 said, what's the output on the console?
Title: Re: SFML 2 RenderWindow::capture
Post by: G. on July 28, 2012, 12:31:12 am
If the directory where you want to save your screenshot doesn't exist, nothing will happen.
Title: Re: SFML 2 RenderWindow::capture
Post by: TwoOfDiamonds on July 30, 2012, 12:03:54 pm
saveToFile will return false, and since I save it as ("screenshot.jpg") there shouldn't be a problem with the folder , right ?
Title: Re: SFML 2 RenderWindow::capture
Post by: eXpl0it3r on July 30, 2012, 02:30:36 pm
We would be more interested in the console print out than the return value...
If the application has no right to write to that specific directory there can still be problems.