Taking up-to-date screenshots

If I use SDL_SaveBMP(SDL_GetVideoSurface(), filename), then it saves the
back-buffer to disk, rather than what is actually currently displayed on
screen, which may be very different if a lot changed in the last frame.
Is there any way I can get it to write out the actual surface that is
being displayed? Calling SDL_Flip, then SDL_SaveBMP, then SDL_Flip again
works, but this also causes some flicker, as you might imagine…–
Ben Sizer

“Kylotan” a ?crit dans le message news:
mailman.1015086842.27488.sdl at libsdl.org

If I use SDL_SaveBMP(SDL_GetVideoSurface(), filename), then it saves the
back-buffer to disk, rather than what is actually currently displayed on
screen, which may be very different if a lot changed in the last frame.
Is there any way I can get it to write out the actual surface that is
being displayed? Calling SDL_Flip, then SDL_SaveBMP, then SDL_Flip again
works, but this also causes some flicker, as you might imagine…


Ben Sizer

use
screen=SDL_GetVideoSurface();
SDL_UpdateRects(screen,0,0);
just before your saving.

or if it flick too much, find the lasts rects to update, then
SDL_UpdateRects(screen,1,&RectToUpdate);

Jocelyn.>