31
SFML projects / Re: Screenshot Thread
« on: July 28, 2015, 05:49:54 pm »
My simplistic shooter game. Pew pew pew...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Not sure if the code you linked to works but I think its intention is to copy the window into the clipboard. If you're just capturing the window and saving that capture, SFML's window.capture() is perfectly fine, just as you've used it.
I haven't thought it would be that simple.#ifdef SFML_SYSTEM_WINDOWS
if (GetAsyncKeyState(VK_SNAPSHOT))
{
window.capture().saveToFile("screenshot.png");
}
#endif // SFML_SYSTEM_WINDOWS
This is not an event - it's a realtime query - so it would need to be used outside of the event loop. This would constantly update the screenshot as quickly as it can (capture is pretty slow though) so you might want to delay this test after it's been activated but that might not be necessary.
Be aware that using this code stops your code being portable and you should consider wrapping it to make sure it's only used on Windows, and also provide an option for other operating systems to use (maybe a different key).