raul.salas Posted December 17, 2019 Posted December 17, 2019 Hi, Is any way to get the current screen resolution? (not window resolution) I've searching on docs and i've not found any info. Raúl Salas
silent Posted December 17, 2019 Posted December 17, 2019 Hi Raul, There are no such methods available in API. For a simple case it may look like this (https://stackoverflow.com/a/50205813): #if WIN32 #include <windows.h> #else #include <X11/Xlib.h> #endif //... void getScreenResolution(int &width, int &height) { #if WIN32 width = (int) GetSystemMetrics(SM_CXSCREEN); height = (int) GetSystemMetrics(SM_CYSCREEN); #else Display* disp = XOpenDisplay(NULL); Screen* scrn = DefaultScreenOfDisplay(disp); width = scrn->width; height = scrn->height; #endif } int main() { int width, height; getScreenResolution(width, height); printf("Screen resolution: %dx%d\n", width, height); } How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts