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

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

Merged
merged 3 commits into from
Apr 15, 2022

Conversation

iaomw
Copy link
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.

@@ -45,6 +45,9 @@ namespace Pilot
void draw_frame();
int clear();
void setDefaultStyle();
protected:
float contentScale();
Copy link
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
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
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
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