Browse Source

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.
pull/14/head
Vladimír Vondruš 5 years ago
parent
commit
5994150a68
  1. 2
      doc/python/pages/changelog.rst
  2. 7
      src/python/magnum/platform/glfw.cpp

2
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`)

7
src/python/magnum/platform/glfw.cpp

@ -188,7 +188,12 @@ void glfw(py::module_& m) {
};
py::class_<PublicizedApplication, PyApplication, ApplicationHolder<PublicizedApplication>> 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<PublicizedApplication::ExitEvent> exitEvent_{glfwApplication, "ExitEvent", "Exit event"};
PyNonDestructibleClass<PublicizedApplication::ViewportEvent> viewportEvent_{glfwApplication, "ViewportEvent", "Viewport event"};

Loading…
Cancel
Save