add Window::request_redraw()

This commit is contained in:
Josh Holtrop 2016-12-11 20:39:02 -05:00
parent 1232539495
commit 659a64b367
2 changed files with 7 additions and 0 deletions

View File

@ -139,6 +139,11 @@ void Window::run_event_loop()
while ((!m_exit_requested) && SDL_WaitEvent(&event))
{
handle_event(event);
if (m_redraw_requested)
{
m_redraw_requested = false;
redraw();
}
}
}

View File

@ -15,6 +15,7 @@ class Window
public:
bool create(std::shared_ptr<Buffer> buffer);
void run_event_loop();
void request_redraw() { m_redraw_requested = true; }
protected:
enum : uint32_t
@ -35,6 +36,7 @@ protected:
SDL_Window * m_window;
bool m_exit_requested;
bool m_redraw_requested;
int m_width;
int m_height;