diff options
Diffstat (limited to 'test/window_test.cpp')
-rw-r--r-- | test/window_test.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/test/window_test.cpp b/test/window_test.cpp index 70fcb1a..2136488 100644 --- a/test/window_test.cpp +++ b/test/window_test.cpp @@ -2,21 +2,37 @@ #include "video.hpp" #include <iostream> +#include <thread> +#include <mutex> int main(int argc, char *argv[]) { wrapsdl2::initialize(); { - wrapsdl2::window win("Window Test", 800, 600); + using namespace wrapsdl2; + + window win("Window Test", 800, 600); + std::mutex win_mutex; std::cout << "press ENTER to show the window" << std::endl; std::cin.get(); win.show(); - win.update(); + + std::thread win_update([&]() { + std::lock_guard<std::mutex> lock(win_mutex); + while (win.is_open()) { + win.update(); + wrapsdl2::delay(200); + + + } + }); std::cout << "press ENTER to quit" << std::endl; std::cin.get(); + + win_update.join(); } wrapsdl2::quit(); |