Add full high DPI information to SDL_DisplayMode

SDL_DisplayMode now includes the pixel size, the screen size and the relationship between the two. For example, a 4K display at 200% scale could have a pixel size of 3840x2160, a screen size of 1920x1080, and a display scale of 2.0.
This commit is contained in:
Sam Lantinga 2023-01-27 10:46:51 -08:00
parent b23d20cd4d
commit 24fec13ac1
31 changed files with 370 additions and 345 deletions

View file

@ -129,7 +129,8 @@ int Emscripten_VideoInit(_THIS)
/* Use a fake 32-bpp desktop mode */
SDL_zero(mode);
mode.format = SDL_PIXELFORMAT_RGB888;
emscripten_get_screen_size(&mode.w, &mode.h);
emscripten_get_screen_size(&mode.screen_w, &mode.screen_h);
mode.display_scale = emscripten_get_device_pixel_ratio();
if (SDL_AddBasicVideoDisplay(&mode) < 0) {
return -1;