I'm trying to create a flashing effect for my game - basically when the player is in danger of some sorts, the screen begins to flash red for a brief amount of time. However, I am not sure how to do this in SDL. I want this to be done via function call that can have an SDL_Color as a parameter that determines the color of the flash.
I honestly have no idea how to go about doing this. The only idea I had come up with was to clear the screen, set the renderer's draw color to the provided color, draw a rectangle, then clear the screen again. But I, despite not believing it would work, tried it and surprise! it didn't.
Any tips on how to go about doing this would be much appreciated.