3

I have tried

SDL_DisplayMode DM;
SDL_GetDesktopDisplayMode(0, &DM);
auto Width = DM.w;
auto Height = DM.h;

but on a high-DPI display it returns the virtual screen resolution. SDL_GetCurrentDisplayMode does the same.

So, how can I get the physical screen size also on high-DPI displays?

Emil Laine
  • 41,598
  • 9
  • 101
  • 157

1 Answers1

1

The only way seems to be to create a fullscreen SDL_Window (passing SDL_WINDOW_ALLOW_HIGHDPI in the flags) and query its "drawable size" with SDL_GL_GetDrawableSize.

Emil Laine
  • 41,598
  • 9
  • 101
  • 157