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

Author Topic: How to take screenshots  (Read 15140 times)

0 Members and 1 Guest are viewing this topic.

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
How to take screenshots
« on: May 12, 2011, 11:53:22 pm »
I'm looking for comand to take a screenshot with SFML 2.0
The App.Capture of 1.6 doesn't work in 2.0 and i didn't find the good comand to do it.
I need to make a menĂ¹ with last frame of the game under it.
So i want to do this
Take screen-> take it in memory -> use the comande Image.LoadFromMemory -> show it under menu interface.
Can i do it? :)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
How to take screenshots
« Reply #1 on: May 13, 2011, 01:07:38 am »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
How to take screenshots
« Reply #2 on: May 13, 2011, 11:50:49 am »
Thanks man ;)

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
How to take screenshots
« Reply #3 on: May 13, 2011, 01:10:21 pm »
A question... i want to save my screenshot by numbers
Ex: screen001,screen002 etc.
I made this code but i don't know how to put into SaveToFile()_
Code: [Select]

char screen[50];
int numScreen=4;
sprintf (screen, "%03d", numScreen);


So if i do cout << screen; i get 004 etc.
Can you help me? :)

Fred_FS

  • Newbie
  • *
  • Posts: 48
    • View Profile
How to take screenshots
« Reply #4 on: May 13, 2011, 01:26:51 pm »
If you're programming c++, you should use c++ ;).

I recommend std::stringstream to you. It should look like this:
Code: [Select]

std::stringstream filename;
filename << "screenshots/screenshot_" << screenshot_num_ << ".png";
Image.SaveToFile( filename.str() );

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
How to take screenshots
« Reply #5 on: May 13, 2011, 01:34:39 pm »
Quote from: "Fred_FS"
If you're programming c++, you should use c++ ;).

I recommend std::stringstream to you. It should look like this:
Code: [Select]

std::stringstream filename;
filename << "screenshots/screenshot_" << screenshot_num_ << ".png";
Image.SaveToFile( filename.str() );

You... you are a f*cking genius LOL
Thx a lot :)
Now i've to lern how to avoid FPS Overlay benn captured by game :)

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
How to take screenshots
« Reply #6 on: May 13, 2011, 02:33:55 pm »
There's probably a better way to do it, but the first thing that comes to mind is ...

Code: [Select]
If screenshot button pressed
    takeScreenshot = true

//Drawing stuff
if !takeScreenshot
    draw FPS

blah blah

if takeScreenshot
    take screenshot


I am rather tired so sorry if this is impossible/stupid/doesn't work :)

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
How to take screenshots
« Reply #7 on: May 13, 2011, 03:28:23 pm »
Quote from: "Walker"
There's probably a better way to do it, but the first thing that comes to mind is ...

Code: [Select]
If screenshot button pressed
    takeScreenshot = true

//Drawing stuff
if !takeScreenshot
    draw FPS

blah blah

if takeScreenshot
    take screenshot


I am rather tired so sorry if this is impossible/stupid/doesn't work :)


The problem is that FPS shown on screen is not from game... is from a third-party program (Fraps/Play Claw etc). I don't know why it capture this overlay too, but i can't find a solution to isolate it

Fred_FS

  • Newbie
  • *
  • Posts: 48
    • View Profile
How to take screenshots
« Reply #8 on: May 13, 2011, 03:37:53 pm »
It is called "screenshot". Hence it captures what's on the screen. And the overly is on the screen, hence it is captured ;).
The easiest way would probably be not to use these FPS-applications, if you want to create a screenshot.

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
How to take screenshots
« Reply #9 on: May 13, 2011, 04:54:44 pm »
Quote from: "Fred_FS"
It is called "screenshot". Hence it captures what's on the screen. And the overly is on the screen, hence it is captured ;).
The easiest way would probably be not to use these FPS-applications, if you want to create a screenshot.


Uhm but there are some games that doesn't capture FPS :(
(I've just take some screenshots in Portal 2)

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
How to take screenshots
« Reply #10 on: May 14, 2011, 01:42:07 am »
They probably write some windows specific code to omit that. Not something you can do purely trough SFML. I recommend instead that you have your own FPS overlay built into the application. And any other debug information you might need.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
How to take screenshots
« Reply #11 on: May 14, 2011, 10:17:29 am »
Quote from: "Groogy"
They probably write some windows specific code to omit that. Not something you can do purely trough SFML. I recommend instead that you have your own FPS overlay built into the application. And any other debug information you might need.


Ah ok :(
Thanks for infos!