diff options
Diffstat (limited to 'modules/window-vulkan/examples/window_create.cpp')
-rw-r--r-- | modules/window-vulkan/examples/window_create.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/window-vulkan/examples/window_create.cpp b/modules/window-vulkan/examples/window_create.cpp new file mode 100644 index 0000000..a5a2ae4 --- /dev/null +++ b/modules/window-vulkan/examples/window_create.cpp @@ -0,0 +1,34 @@ +#include <forstio/io/io.hpp> + +#include <iostream> + +int main(){ + auto eo_aio = saw::setup_async_io(); + if(eo_aio.is_error()){ + auto& err = eo_aio.get_error(); + std::cerr<<"Error: "<<err.get_category(); + + auto err_msg = err.get_message(); + if(err_msg.size() > 0u){ + std::cerr<<" - "<<err_msg; + } + + std::cerr<<std::endl; + return err.get_id(); + } + auto& aio = eo_aio.get_value(); + saw::wait_scope wait{aio.event_loop}; + + bool running = true; + + aio.event_port.on_signal(saw::Signal::Terminate).then([&running](){ + running = false; + }).detach(); + + while(running){ + device->flush(); + wait.wait(std::chrono::seconds{1u}); + } + + return 0; +} |