0

how would i go about capturing my computer's screen with SDL? is this possible with SDL? i wanted to try something like applying a surface to the main renderer (if that makes any sense either) and then call:

SDL_SaveBMP(back_buffer, "screen.png");

how would i do what i want to do if it is possible? has anyone done this before?

genpfault
  • 51,148
  • 11
  • 85
  • 139
evolon696
  • 269
  • 1
  • 4
  • 13

2 Answers2

2

This cannot be done. What you are describing is a platform dependent operation which is not implemented by SDL.

  • well that sucks. are there any other methods you would prefer that i could use? – evolon696 Jan 12 '12 at 19:09
  • @evolon696: You'll have to find the OS's specific API calls for each system you want to support. Which platforms are you targeting? –  Jan 12 '12 at 19:11
  • debian and windows. i am familiar with both. suggestions? – evolon696 Jan 12 '12 at 19:12
  • @evolon696: For Windows-[Fastest Method of Screen Capturing](http://stackoverflow.com/questions/5069104/fastest-method-of-screen-capturing). – Jesse Good Jan 12 '12 at 20:57
0

I hope this helps: Try to create a new surface by combining all the surfaces you want to render into one( by using getpixel() and putpixel() functions -you man need to make them yourself- ), then SDL_SaveBMP( newsurface,"name.bmp") ( I personally don't know if SaveBMP can save .png files )

Mihai
  • 307
  • 2
  • 6
  • 14