Add DPI scaling to IMGUI

Signed-off-by: nvsickle <nvsickle@amazon.com>
This commit is contained in:
nvsickle
2021-06-21 22:15:39 -07:00
parent 0c97888d0f
commit dd20a598b2
10 changed files with 58 additions and 2 deletions
@@ -105,10 +105,20 @@ namespace AZ
// Let our ImguiAtomSystemComponent know once we successfully connect and update the viewport size.
if (!m_initialized)
{
auto atomViewportRequests = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
auto defaultViewportContext = atomViewportRequests->GetDefaultViewportContext();
OnViewportDpiScalingChanged(defaultViewportContext->GetDpiScalingFactor());
m_initialized = true;
}
});
#endif
#endif //define(IMGUI_ENABLED)
}
void ImguiAtomSystemComponent::OnViewportDpiScalingChanged(float dpiScale)
{
#if defined(IMGUI_ENABLED)
ImGui::ImGuiManagerBus::Broadcast(&ImGui::ImGuiManagerBus::Events::SetDpiScalingFactor, dpiScale);
#endif //define(IMGUI_ENABLED)
}
}
}