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

Set current DPI scale for HDPI monitors #5

Merged
merged 2 commits into from
Nov 22, 2021
Merged

Set current DPI scale for HDPI monitors #5

merged 2 commits into from
Nov 22, 2021

Conversation

lslm
Copy link
Owner

@lslm lslm commented Nov 21, 2021

Context

Current Dear ImGui does not have a canonical solution to handle adaptive DPI for multiple monitors.

Proposed solution

I decided to use the glfwGetWindowContentScale(window, &xScale, &yScale) function to get the monitor scale and set the values of xScale and yScale into the io.DisplayFramebufferScale.
This might not be the best solution, but I will use it to make the UI elements look better in HDPI monitors like MacBooks' Retina Display.

References

ocornut/imgui#1786
ocornut/imgui#1676
Why retina screen coordinate value is twice the value of pixel value
How should I handle DPI in my application?
ocornut/imgui#1786 (comment)

@lslm lslm self-assigned this Nov 21, 2021
@lslm lslm force-pushed the ls/fix-dpi-scaling branch 2 times, most recently from 6008831 to 46dd268 Compare November 21, 2021 16:26
This might not be the best solution, but I will use it
to make the UI elements looks better in HDPI monitors like MacBooks'
Retina Display
@lslm lslm merged commit 6b22d2b into master Nov 22, 2021
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

Successfully merging this pull request may close these issues.

1 participant