wjakob / nanogui

Minimalistic GUI library for OpenGL
Other
4.66k stars 608 forks source link

Ask for confirmation when closing window #110

Closed joelpp closed 8 years ago

joelpp commented 8 years ago

Hi, I'm trying to figure out a good way to prompt users with a message dialog when they try to close the main window. I made my own main loop where I do the same as nanogui::mainloop(), but moved the glfwWindowShouldClose() check elsewhere; every frame, I check it and if it is set, pop a message dialog which controls glfwSetWindowShouldClose and sets a global boolean which stops my custom main loop.

Is there a simpler way to do this that I missed? I feel like copying your main loop function might not be the most elegant. Thanks a lot!

wjakob commented 8 years ago

Hi,

this is a bit too specialized for inclusion in pybind11, I think you'll have to write your own main loop to support this.

Best, Wenzel

joelpp commented 8 years ago

Thanks for your answer - I'm writing my own main loop then. Just to make sure I understand - you mean this feature could be implemented on the c++ side but making the nanogui python bindings work with it would be overly complicated?

wjakob commented 8 years ago

This is a minimalistic GUI library, which on the other hand means that it may not have what you want. Forking is the way to go rather than adding every possible feature here.