-next-
Updating the Screen

Once you've drawn onto the screen, you need to update it so that the changes appear on the screen.

When animating, to reduce flicker, you should keep track of what parts of the screen will need updating at the end of the frame. (Those parts are known as "dirty rectangles.")

SDL_UpdateRects(scr, num_rects, rects);

If you're changing a lot or all of the screen during every frame, you can just update the entire screen at once.

SDL_UpdateRect(scr, 0, 0, scr -> w, scr -> h);

If you're using double-buffering, you can use SDL_Flip(). (Even if you aren't, you can use it, and it works just like the above example.)

SDL_Flip(scr);