commit 37b81b503f8c3c3735f9b4114a045f6f50fc97c9
parent feeb29de55351d08335d501e6605c1940aa8ed81
Author: falkTX <falktx@falktx.com>
Date: Sat, 15 May 2021 21:28:58 +0100
imgui: use scale factor from DPF
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/examples/ImguiSimpleGain/ImGuiUI.cpp b/examples/ImguiSimpleGain/ImGuiUI.cpp
@@ -41,9 +41,6 @@ struct ImGuiUI::Impl
void setupGL();
void cleanupGL();
- // perhaps DPF will implement this in the future
- float getScaleFactor() const { return 1.0f; }
-
static int mouseButtonToImGui(int button);
ImGuiUI* fSelf = nullptr;
@@ -178,7 +175,8 @@ bool ImGuiUI::onMotion(const MotionEvent& event)
ImGui::SetCurrentContext(fImpl->fContext);
ImGuiIO &io = ImGui::GetIO();
- const float scaleFactor = fImpl->getScaleFactor();
+ // FIXME
+ const double scaleFactor = 1; // getScaleFactor();
io.MousePos.x = std::round(scaleFactor * event.pos.getX());
io.MousePos.y = std::round(scaleFactor * event.pos.getY());
@@ -206,7 +204,7 @@ void ImGuiUI::onResize(const ResizeEvent& event)
ImGui::SetCurrentContext(fImpl->fContext);
ImGuiIO &io = ImGui::GetIO();
- const float scaleFactor = fImpl->getScaleFactor();
+ const double scaleFactor = getScaleFactor();
io.DisplaySize.x = std::round(scaleFactor * width);
io.DisplaySize.y = std::round(scaleFactor * height);
}
@@ -252,7 +250,7 @@ void ImGuiUI::Impl::setupGL()
ImGui::SetCurrentContext(fContext);
ImGuiIO &io = ImGui::GetIO();
- const float scaleFactor = getScaleFactor();
+ const double scaleFactor = fSelf->getScaleFactor();
io.DisplaySize.x = std::round(scaleFactor * fSelf->getWidth());
io.DisplaySize.y = std::round(scaleFactor * fSelf->getHeight());
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;