diff options
author | David Robillard <d@drobilla.net> | 2020-11-01 13:17:59 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-01 13:43:16 +0100 |
commit | 71a9fbf296928d3599743e88f72390ff827c5ab3 (patch) | |
tree | 473f96ae254843f4bbfd3d5b9b6f1acb4fce2ce8 /examples | |
parent | 92edbddd304c5df0b1c89b8248053b0c1bfd9158 (diff) | |
download | pugl-71a9fbf296928d3599743e88f72390ff827c5ab3.tar.gz pugl-71a9fbf296928d3599743e88f72390ff827c5ab3.tar.bz2 pugl-71a9fbf296928d3599743e88f72390ff827c5ab3.zip |
Make event handling in C++ more flexible
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pugl_cxx_demo.cpp | 10 | ||||
-rw-r--r-- | examples/pugl_vulkan_cxx_demo.cpp | 14 |
2 files changed, 14 insertions, 10 deletions
diff --git a/examples/pugl_cxx_demo.cpp b/examples/pugl_cxx_demo.cpp index 4dab35c..9767345 100644 --- a/examples/pugl_cxx_demo.cpp +++ b/examples/pugl_cxx_demo.cpp @@ -29,14 +29,16 @@ #include <cmath> -class CubeView : public pugl::View<CubeView> +class CubeView : public pugl::View { public: explicit CubeView(pugl::World& world) - : pugl::View<CubeView>{world} - {} + : pugl::View{world} + { + setEventHandler(*this); + } - using pugl::View<CubeView>::onEvent; + using pugl::View::onEvent; static pugl::Status onEvent(const pugl::ConfigureEvent& event) noexcept; pugl::Status onEvent(const pugl::UpdateEvent& event) noexcept; diff --git a/examples/pugl_vulkan_cxx_demo.cpp b/examples/pugl_vulkan_cxx_demo.cpp index a4634ee..e25f243 100644 --- a/examples/pugl_vulkan_cxx_demo.cpp +++ b/examples/pugl_vulkan_cxx_demo.cpp @@ -78,7 +78,7 @@ struct VulkanContext { struct GraphicsDevice { VkResult init(const pugl::VulkanLoader& loader, const VulkanContext& context, - pugl::ViewBase& view, + pugl::View& view, const PuglTestOptions& opts); sk::SurfaceKHR surface; @@ -409,7 +409,7 @@ selectPhysicalDevice(const sk::VulkanApi& vk, VkResult GraphicsDevice::init(const pugl::VulkanLoader& loader, const VulkanContext& context, - pugl::ViewBase& view, + pugl::View& view, const PuglTestOptions& opts) { const auto& vk = context.vk; @@ -1372,15 +1372,17 @@ recordCommandBuffers(const sk::VulkanApi& vk, class PuglVulkanDemo; -class View : public pugl::View<View> +class View : public pugl::View { public: View(pugl::World& world, PuglVulkanDemo& app) - : pugl::View<View>{world} + : pugl::View{world} , _app{app} - {} + { + setEventHandler(*this); + } - using pugl::View<View>::onEvent; + using pugl::View::onEvent; pugl::Status onEvent(const pugl::ConfigureEvent& event); pugl::Status onEvent(const pugl::UpdateEvent& event); |