Skip to content

Commit

Permalink
Add a clear function to the window.
Browse files Browse the repository at this point in the history
Also clear the window in the constructor.
  • Loading branch information
mordante committed May 10, 2014
1 parent 6edb01b commit d20c120
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sdl/window.cpp
Expand Up @@ -54,6 +54,8 @@ twindow::twindow(const std::string& title,
}

pixel_format_ = info.texture_formats[0];

clear();
}

twindow::~twindow()
Expand All @@ -73,6 +75,14 @@ void twindow::full_screen()
/** @todo Implement. */
}

void twindow::clear()
{
if(SDL_RenderClear(*this) != 0) {
throw texception("Failed to clear the SDL_Renderer object.",
true);
}
}

void twindow::render()
{
SDL_RenderPresent(*this);
Expand Down
3 changes: 3 additions & 0 deletions src/sdl/window.hpp
Expand Up @@ -98,6 +98,9 @@ class twindow : private boost::noncopyable
*/
void full_screen();

/** Clears the contents of the window. */
void clear();

/** Renders the contents of the window. */
void render();

Expand Down

0 comments on commit d20c120

Please sign in to comment.