Add a function that clears the window with a specified color.

This commit is contained in:
Boldizsár Lipka 2014-06-05 15:58:45 +02:00
parent bccfa89910
commit f3258c7504
2 changed files with 18 additions and 0 deletions

View file

@ -83,6 +83,15 @@ void twindow::clear()
}
}
void twindow::clear(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
SDL_SetRenderDrawColor(*this, r, g, b, a);
if(SDL_RenderClear(*this) != 0) {
throw texception("Failed to clear the SDL_Renderer object.",
true);
}
}
void twindow::render()
{
SDL_RenderPresent(*this);

View file

@ -101,6 +101,15 @@ public:
/** Clears the contents of the window. */
void clear();
/**
* Clears the contents of the window with a given color.
*
* @param r Red value of the color.
* @param g Green value of the color.
* @param b Blue value of the color.
*/
void clear(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 0);
/** Renders the contents of the window. */
void render();