Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2 RenderWindow::capture  (Read 3585 times)

0 Members and 1 Guest are viewing this topic.

TwoOfDiamonds

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
SFML 2 RenderWindow::capture
« 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

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Re: SFML 2 RenderWindow::capture
« Reply #1 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: SFML 2 RenderWindow::capture
« Reply #2 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: SFML 2 RenderWindow::capture
« Reply #3 on: July 28, 2012, 12:31:12 am »
If the directory where you want to save your screenshot doesn't exist, nothing will happen.

TwoOfDiamonds

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: SFML 2 RenderWindow::capture
« Reply #4 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 ?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: SFML 2 RenderWindow::capture
« Reply #5 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything