mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Styles: Added ImGuiStyle::ScaleAllSizes(float) helper to make it easier to have application transition to e.g. High DPI with a matching style.
This commit is contained in:
23
imgui.cpp
23
imgui.cpp
@ -744,6 +744,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
|
||||
|
Reference in New Issue
Block a user