I render all my surfaces to a buffer, then at the end of the frame I flip the buffer.
However, when a certain event is happening in the game, I wanted to shake the buffer around to add intensity. Rather than blitting each surface at the offset individually, I thought I would just offset the entire buffer at the end of the frame, since I wanted everything of the buffer to shake.
Is there a way that I can render to buffer at on offset, or do I need to then blit the buffer to a second buffer and flip that?
You can make a function and put it right before your render.
It should get a random direction (up, down, left or right), and add the same small transformation for all textures being rendered at that frame (all textures should be moved a little bit down in that frame, for example).
In the next frame you get again a random direction, avoiding the last one picked.
The function should also have a timer (use SDL_GetTicks() ), so you can set how long is the shaking going to last.
I don’t know if I was clear but, good luck anyway. 🙂