diff --git a/include/nanogui/screen.h b/include/nanogui/screen.h index 709789b4da..0135c37b38 100644 --- a/include/nanogui/screen.h +++ b/include/nanogui/screen.h @@ -104,6 +104,9 @@ class NANOGUI_EXPORT Screen : public Widget { /// Set window size void setSize(const Vector2i& size); + /// Set window size limits + void setSizeLimits(const Vector2i& minsize, const Vector2i& maxsize); + /// Draw the Screen contents virtual void drawAll(); diff --git a/src/screen.cpp b/src/screen.cpp index cc57a0b861..01c9d33ff8 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -369,6 +369,10 @@ void Screen::setSize(const Vector2i &size) { #endif } +void Screen::setSizeLimits(const Vector2i& minsize, const Vector2i& maxsize) { + glfwSetWindowSizeLimits(mGLFWWindow, minsize[0], minsize[1], maxsize[0], maxsize[1]); +} + void Screen::drawAll() { glClearColor(mBackground[0], mBackground[1], mBackground[2], mBackground[3]); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);