I'm using pixel-perfect source images and SDL2 to make a program. When set to fullscreen, I'd like it to use the native resolution (the SDL_WINDOW_FULLSCREEN_DESKTOP flag) but only between a certain minimum resolution and a reasonable maximum one, after which it will stretch from the largest legal resolution. The problem is that I can only find references to the program's own window or program size on the SDL2 documentation.
Is there any function in SDL from which I could retrieve the screen width and height at least almost directly?
Or I should do something like using SDL_WINDOW_FULLCREEN_DESKTOP and then SDL_GetWindowSize() and resizing the window again? Would this even work as expected? I'd like to fins a more elegant solution than that. It feels dirty.
See Question&Answers more detail:os