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

High DPI support #4

Closed
ccqil opened this issue Apr 4, 2022 · 4 comments
Closed

High DPI support #4

ccqil opened this issue Apr 4, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@ccqil
Copy link

ccqil commented Apr 4, 2022

My screen is 3840 x 2160 and everything so small that it's unreadable/unusable.

This is a problem with imgui. And you can check feature/hidpi-support to fix it.

@JX-Master
Copy link

On Windows 10 1607 and above, the Win32 API GetDpiForWindow will fetch the DPI value for the specified window. The value is 96 by default, and the scaled UI size can be computed by:

int zoom = GetDpiForWindow(window->m_hwnd);
float scale = (float)zoom / 96.0f;
width = (unsigned int)(width / scale);
height = (unsigned int)(height / scale);

As far as I know, there is no equivalent API on Mac platforms.

@hyv1001 hyv1001 added the enhancement New feature or request label Apr 4, 2022
@hybcloud
Copy link
Contributor

hybcloud commented Apr 7, 2022

just double the font size, almost everthing in imgui adjust to font size.

@iaomw
Copy link
Contributor

iaomw commented Apr 8, 2022

On Windows 10 1607 and above, the Win32 API GetDpiForWindow will fetch the DPI value for the specified window. The value is 96 by default, and the scaled UI size can be computed by:

int zoom = GetDpiForWindow(window->m_hwnd);
float scale = (float)zoom / 96.0f;
width = (unsigned int)(width / scale);
height = (unsigned int)(height / scale);

As far as I know, there is no equivalent API on Mac platforms.

There are surely some native API dealing DPI on macOS. Apple has its ownAPIs almost for anything.
If we don't want introduce new libraries, ImGui and GLFW could also do the job. ImGui is buggy though test, so prefer GLFW.

image

@hyv1001
Copy link
Collaborator

hyv1001 commented Apr 9, 2022

Should be fixed by #85, feel free to reopen if issue still exists

@hyv1001 hyv1001 closed this as completed Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants