Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setSizeLimits #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/nanogui/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 4 additions & 0 deletions src/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 4 spaces for indentation.

}

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);
Expand Down