From eae448239986ef4cb2833b5c7c1313e86f28b233 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 29 Sep 2019 20:25:41 -0700 Subject: ImGui UWP: fixed window resizing --- Imgui/interface/ImGuiImplUWP.h | 8 ++++++++ Imgui/src/ImGuiImplUWP.cpp | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Imgui/interface/ImGuiImplUWP.h b/Imgui/interface/ImGuiImplUWP.h index f65cdeb..f41d468 100644 --- a/Imgui/interface/ImGuiImplUWP.h +++ b/Imgui/interface/ImGuiImplUWP.h @@ -46,9 +46,17 @@ public: virtual void NewFrame()override final; + void SetDisplaySize(Uint32 DisplayWidth, Uint32 DisplayHeight) + { + m_DisplayWidth = DisplayWidth; + m_DisplayHeight = DisplayHeight; + } + private: INT64 m_Time = 0; INT64 m_TicksPerSecond = 0; + Uint32 m_DisplayWidth = 0; + Uint32 m_DisplayHeight = 0; }; } diff --git a/Imgui/src/ImGuiImplUWP.cpp b/Imgui/src/ImGuiImplUWP.cpp index 4389785..16f1007 100644 --- a/Imgui/src/ImGuiImplUWP.cpp +++ b/Imgui/src/ImGuiImplUWP.cpp @@ -82,10 +82,7 @@ void ImGuiImplUWP::NewFrame() ImGuiIO& io = ImGui::GetIO(); IM_ASSERT(io.Fonts->IsBuilt() && "Font atlas not built! It is generally built by the renderer back-end. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame()."); - // Setup display size (every frame to accommodate for window resizing) - RECT rect = {0, 0, 1280, 1024}; - //::GetClientRect(g_hWnd, &rect); - io.DisplaySize = ImVec2((float)(rect.right - rect.left), (float)(rect.bottom - rect.top)); + io.DisplaySize = ImVec2((float)m_DisplayWidth, (float)m_DisplayHeight); // Setup time step INT64 current_time; -- cgit v1.2.3