that_editor
that_editor copied to clipboard
Implemented high-DPI support
This is done by initializing the SDL_Window
with the SDL_WINDOW_ALLOW_HIGHDPI
flag. Alone, that flag is not enough. So, I use SDL_GL_GetDrawableSize()
to fetch the real size of the window. I then create two 'scaling factor' variables, one for each dimension. The 'scaling factor' variables are calculated by dividing the output of SDL_GL_GetDrawableSize
by the original window size... i.e. pixels_width
, pixels_height
. Then, in the function SDL_ReDraw
(by Bisqwit), the destination rectangle (trect
) is scaled by the scaling factors, creating a smooth, crisp display on high-DPI monitors.