From 37b81b503f8c3c3735f9b4114a045f6f50fc97c9 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 15 May 2021 21:29:25 +0100 Subject: [PATCH] imgui: use scale factor from DPF Signed-off-by: falkTX --- examples/ImguiSimpleGain/ImGuiUI.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/ImguiSimpleGain/ImGuiUI.cpp b/examples/ImguiSimpleGain/ImGuiUI.cpp index 629ba259..fae28d5f 100644 --- 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;