Added SDL_EVENT_DISPLAY_SCALE_CHANGED

This commit is contained in:
Sam Lantinga 2023-03-03 11:03:50 -08:00
parent 16f4e37bb5
commit 6b87d1938f
6 changed files with 30 additions and 6 deletions

View file

@ -1511,6 +1511,17 @@ static void SDLTest_PrintEvent(SDL_Event *event)
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " connected",
event->display.displayID);
break;
case SDL_EVENT_DISPLAY_SCALE_CHANGED:
{
float display_scale = 1.0f;
const SDL_DisplayMode *mode = SDL_GetDesktopDisplayMode(event->display.displayID);
if (mode) {
display_scale = mode->display_scale;
}
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed scale to %d%%",
event->display.displayID, (int)(display_scale * 100.0f));
}
break;
case SDL_EVENT_DISPLAY_MOVED:
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed position",
event->display.displayID);