Fleury's picture

Minimum Window Size

Windows, Linux, and Mac OS X all have APIs for setting the minimum size for a window, but I can't find any functions in GameWindow to accomplish that. My solution right now is to resize the window in the resize event if the size goes below some specified value, it's a very sketchy solution though (flickers horribly on Windows, leaves the cursor icon as a resize cursor on Mac OS X, haven't even tested it on Ubuntu (but I'm sure it has some side effect there aswell)).

What's the correct way to do this? :|


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Fleury's picture

Thought up a slightly better solution just now, rather than resize on the resize event, I delay resizing until the next render (since rendering seems to be paused while the window is resizing). This solution still stinks, but it doesn't flicker horribly on Windows, and the cursor icon gets confused slightly less often now on Mac OS X.

dimension314's picture

I've wondered the same thing, was pretty surprised when I found gamewindow had no min/max size properties. I've settled for preventing the resize as you did at first, but yes the flickering is annoying. Would be interested to hear if there was some easier way to do this that we've missed.

______________________________________________________________________________________________
Try out the project I'm working on: http://www.voxelgame.com

Inertia's picture

The design philosophy was that Gamewindow serves for "fullscreen" applications and GLControl for anything the user can resize. Delaying resizes is the only way to go atm. Fiddler implemented it and is the only one who can give you an answer to his plans regarding it.
You're welcome to add a feature request Issue so it can be tracked.

dimension314's picture

I chose GameWindow as it seemed better for a game with the built in timing events, and assumed it would be more efficient then using the control, but still want to allow resizing.

Interesting just playing with the examples included with OpenTK, the GameWindow simple example can resize but stops rendering while resizing as mentioned earlier, however when resizing the GLControl simple example the rendering keeps up with the resize which all makes sense. For the big picture though this is a pretty minor issue, I doubt people are trying to resize below my minimum very often and nothing is actually broken. At some point I'll just implement the delayed resize, just thought there may have been a more "preferred" way. Thanks for the info.

______________________________________________________________________________________________
Try out the project I'm working on: http://www.voxelgame.com