Skip to content

Fix overlapped button, ImGui::Indent should also consider DPI scale#118

Merged
hyv1001 merged 3 commits intoBoomingTech:mainfrom
iaomw:indent
Apr 15, 2022
Merged

Fix overlapped button, ImGui::Indent should also consider DPI scale#118
hyv1001 merged 3 commits intoBoomingTech:mainfrom
iaomw:indent

Conversation

@iaomw
Copy link
Copy Markdown
Contributor

@iaomw iaomw commented Apr 14, 2022

As the title, there is a button overlapped by other GUI elements while resolution scale is larger than 100%. #92
Case ImGui::Indent also need consider DPI scale on Windows.

However, the real problem might be GLFW. It's using virtual resolution on macOS but real pixel resolution on Windows.
Eventually, it will have side-effect on ImGui.

Tested on:
Windows 10 Pro 21h2
macOS BIg sur 11.6.5

Not tested on Linux.

int clear();
void setDefaultStyle();
protected:
float contentScale();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest naming: float getConentScale() const and float getIndentScale() const

@hyv1001
Copy link
Copy Markdown
Collaborator

hyv1001 commented Apr 14, 2022

Thx for your awesome work, I will test it on Linux!
There are some suggestions about the function naming, plz check.

@iaomw
Copy link
Copy Markdown
Contributor Author

iaomw commented Apr 15, 2022

Although glfwGetWindowContentScale only takes roughly 0.03ms on my CPU, it might be better to cache the result.
I was considering saving the result into one of classes: SurfaceIO, SurfaceRHI, UIState. After reading the source code, I am not sure which one is the best choice.

@hyv1001 hyv1001 merged commit f707783 into BoomingTech:main Apr 15, 2022
@hyv1001
Copy link
Copy Markdown
Collaborator

hyv1001 commented Apr 15, 2022

Although glfwGetWindowContentScale only takes roughly 0.03ms on my CPU, it might be better to cache the result. I was considering saving the result into one of classes: SurfaceIO, SurfaceRHI, UIState. After reading the source code, I am not sure which one is the best choice.

I think it's a UI-related variable, so SurfaceUI or UIState may be reasonable to store it.

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.

3 participants