From 27492abea2b62893335d655621774cfa82ae336e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 4 Oct 2017 19:58:54 -0700 Subject: [PATCH] Updated ImGui. --- 3rdparty/ocornut-imgui/imgui.cpp | 25 ++++++++++++++++++++++++- 3rdparty/ocornut-imgui/imgui.h | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/ocornut-imgui/imgui.cpp index 8090806a3..58527258d 100644 --- a/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/ocornut-imgui/imgui.cpp @@ -105,7 +105,7 @@ - See examples/ folder for standalone sample applications. To understand the integration process, you can read examples/opengl2_example/ because it is short, then switch to the one more appropriate to your use case. - You may be able to grab and copy a ready made imgui_impl_*** file from the examples/. - - When using Dear ImGui, your programming IDE if your friend: follow the declaration of variables, functions and types to find comments about them. + - When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them. - Init: retrieve the ImGuiIO structure with ImGui::GetIO() and fill the fields marked 'Settings': at minimum you need to set io.DisplaySize (application resolution). Later on you will fill your keyboard mapping, clipboard handlers, and other advanced features but for a basic integration you don't need to worry about it all. @@ -749,6 +749,29 @@ void ImGui::StyleColorsClassic(ImGuiStyle* dst) colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); } +// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you. +// Tips: if you need to change your scale multiple times, prefer calling this on a freshly initialized ImGuiStyle structure rather than scaling multiple times (because floating point multiplications are lossy). +void ImGuiStyle::ScaleAllSizes(float scale_factor) +{ + WindowPadding *= scale_factor; + WindowMinSize *= scale_factor; + WindowRounding *= scale_factor; + ChildWindowRounding *= scale_factor; + FramePadding *= scale_factor; + FrameRounding *= scale_factor; + ItemSpacing *= scale_factor; + ItemInnerSpacing *= scale_factor; + TouchExtraPadding *= scale_factor; + IndentSpacing *= scale_factor; + ColumnsMinSpacing *= scale_factor; + ScrollbarSize *= scale_factor; + ScrollbarRounding *= scale_factor; + GrabMinSize *= scale_factor; + GrabRounding *= scale_factor; + DisplayWindowPadding *= scale_factor; + DisplaySafeAreaPadding *= scale_factor; +} + ImGuiIO::ImGuiIO() { // Most fields are initialized with zero diff --git a/3rdparty/ocornut-imgui/imgui.h b/3rdparty/ocornut-imgui/imgui.h index e1b469ae5..01bc1f22d 100644 --- a/3rdparty/ocornut-imgui/imgui.h +++ b/3rdparty/ocornut-imgui/imgui.h @@ -771,6 +771,7 @@ struct ImGuiStyle ImVec4 Colors[ImGuiCol_COUNT]; IMGUI_API ImGuiStyle(); + IMGUI_API void ScaleAllSizes(float scale_factor); }; // This is where your app communicate with ImGui. Access via ImGui::GetIO().