Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDL] [macOS] SDL_GetDesktopDisplayMode->pixel_density won't update after SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED #9763

Open
dortamiguel opened this issue May 11, 2024 · 0 comments
Assignees
Milestone

Comments

@dortamiguel
Copy link

I'm using SDL_GetDesktopDisplayMode()->pixel_density to get the scale I should use for the UI in my game like this:

float scale_factor = SDL_GetDesktopDisplayMode(SDL_GetDisplayForWindow(window))->pixel_density;

In this case scale_factor will be 1.f in (low resolution) mode or 2.f if the (Default) mode

image

If I change this scale while the game is running the SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED event will happen, but the pixel_density from SDL_GetDesktopDisplayMode won't update. Resizing the window won't help either, the only way of getting the right value is by closing and opening the game again.

Is this a bug or I'm doing something wrong?

In windows to get this same scale I have to use SDL_GetDisplayContentScale but in macos it always returns 1.f, it won't matter if you are in low res mode or high dpi, ¿Is this also a different bug or might be related to this issue?.

@slouken slouken self-assigned this May 22, 2024
@slouken slouken added this to the 3.2.0 milestone May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants