From 5994150a68a216621582f76ecf394d1b42758abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 22 Nov 2021 22:39:41 +0100 Subject: [PATCH] python: expose glfw.Application.{swap_interval,main_loop_iteration}. The first one was for some reason not exposed because it's a write-only property (but all shaders have writeonly properites, so what's the problem?), the second one got added in 2020.06 but the code here was not updated. --- doc/python/pages/changelog.rst | 2 ++ src/python/magnum/platform/glfw.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/python/pages/changelog.rst b/doc/python/pages/changelog.rst index a43c71e..93ac88a 100644 --- a/doc/python/pages/changelog.rst +++ b/doc/python/pages/changelog.rst @@ -80,6 +80,8 @@ Changelog to make the window resizable on startup - Exposed :ref:`platform.sdl2.Application.exit_event` and :ref:`platform.glfw.Application.exit_event` +- Exposed :ref:`platform.glfw.Application.swap_interval` and + :ref:`platform.glfw.Application.main_loop_iteration` - Exposed :ref:`Color3.red()` and other convenience constructors (see :gh:`mosra/magnum-bindings#12`) - Fixed issues with an in-source build (see :gh:`mosra/magnum-bindings#13`) diff --git a/src/python/magnum/platform/glfw.cpp b/src/python/magnum/platform/glfw.cpp index 4a5324b..3bba190 100644 --- a/src/python/magnum/platform/glfw.cpp +++ b/src/python/magnum/platform/glfw.cpp @@ -188,7 +188,12 @@ void glfw(py::module_& m) { }; py::class_> glfwApplication{m, "Application", "GLFW application"}; - /** @todo def_property_writeonly for swap_interval */ + glfwApplication + .def_property("swap_interval", nullptr, + [](PublicizedApplication& self, Int interval) { + self.setSwapInterval(interval); + }, "Swap interval") + .def("main_loop_iteration", &PyApplication::mainLoopIteration, "Run one iteration of application main loop"); PyNonDestructibleClass exitEvent_{glfwApplication, "ExitEvent", "Exit event"}; PyNonDestructibleClass viewportEvent_{glfwApplication, "ViewportEvent", "Viewport event"};