I am trying to find a solution to launch a window as a function of the size of the screen. I know there is the method resize() of the Gtk::Window but it is only pixels and not percent that's the problem.
You can get the screen width and height in pixels in a quick and dirty way like this:
#include <Windows.h> // Need this to get the screen resolution.
// Get the horizontal and vertical screen sizes in pixels:
static void GetDesktopResolution(int& horizontal, int& vertical) {
SetProcessDPIAware();
horizontal = GetSystemMetrics(SM_CXVIRTUALSCREEN);
vertical = GetSystemMetrics(SM_CYVIRTUALSCREEN);
}
For more advanced functionality, like dealing with multiple monitors, check out the link from the first comment on your question. The answers there are not just for OpenGL.
You can get the screen width and height in pixels in a quick and dirty way like this:
For more advanced functionality, like dealing with multiple monitors, check out the link from the first comment on your question. The answers there are not just for OpenGL.