[SDL2]-Clear Screen Window With A Color?

[SDL2]-Clear Screen Window With A Color?

Hi,

My team and I have started working on our new SDL 2 2d video game engine!

How would we clear the SDL 2 window with a color?

We tried the following:
Code:
//-------------------------------------------------------------------------------------------------
void Visuals::ClearWindowWithColor(Uint8 red, Uint8 green, Uint8 blue)
{
SDL_Surface* windowFillSurface;

windowFillSurface = SDL_CreateRGBSurface(0, 640, 480, 32, 0, 0, 0, 0);
SDL_FillRect( windowFillSurface, NULL, SDL_MapRGB(NULL, red, green, blue) );
SDL_BlitSurface(windowFillSurface, NULL, Window, NULL);

}

//-------------------------------------------------------------------------------------------------

but Window is not an SDL Surface.

How would we clear the SDL 2 window with a color?
Thanks!------------------------
JeZ+Lee
JessePalser <AT> Gmail <DOT> com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com

Code:
//-------------------------------------------------------------------------------------------------
void Visuals::ClearWindowWithColor(Uint8 red, Uint8 green, Uint8 blue)
{
SDL_SetRenderDrawColor(Renderer, red, green, blue, 255);
SDL_RenderFillRect(Renderer, NULL);
SDL_RenderPresent(Renderer);
}

//-------------------------------------------------------------------------------------------------------------------------
JeZ+Lee
JessePalser <AT> Gmail <DOT> com
16BitSoft®
Video Game Design Studio
www.16BitSoft.com

First of all you need to create a renderer (see SDL_CreateRenderer),
then look into the renderer functions to see how to draw.