MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / ScaleAllSizes

Method ScaleAllSizes

plugins/Cardinal/src/DearImGui/imgui.cpp:1054–1079  ·  view source on GitHub ↗

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. Important: This operation is lossy because we round all sizes to integer. If you need to change your scale multiples, call this over a freshly initialized ImGuiStyle structure rather than scaling multiple times.

Source from the content-addressed store, hash-verified

1052// 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.
1053// Important: This operation is lossy because we round all sizes to integer. If you need to change your scale multiples, call this over a freshly initialized ImGuiStyle structure rather than scaling multiple times.
1054void ImGuiStyle::ScaleAllSizes(float scale_factor)
1055{
1056 WindowPadding = ImFloor(WindowPadding * scale_factor);
1057 WindowRounding = ImFloor(WindowRounding * scale_factor);
1058 WindowMinSize = ImFloor(WindowMinSize * scale_factor);
1059 ChildRounding = ImFloor(ChildRounding * scale_factor);
1060 PopupRounding = ImFloor(PopupRounding * scale_factor);
1061 FramePadding = ImFloor(FramePadding * scale_factor);
1062 FrameRounding = ImFloor(FrameRounding * scale_factor);
1063 ItemSpacing = ImFloor(ItemSpacing * scale_factor);
1064 ItemInnerSpacing = ImFloor(ItemInnerSpacing * scale_factor);
1065 CellPadding = ImFloor(CellPadding * scale_factor);
1066 TouchExtraPadding = ImFloor(TouchExtraPadding * scale_factor);
1067 IndentSpacing = ImFloor(IndentSpacing * scale_factor);
1068 ColumnsMinSpacing = ImFloor(ColumnsMinSpacing * scale_factor);
1069 ScrollbarSize = ImFloor(ScrollbarSize * scale_factor);
1070 ScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor);
1071 GrabMinSize = ImFloor(GrabMinSize * scale_factor);
1072 GrabRounding = ImFloor(GrabRounding * scale_factor);
1073 LogSliderDeadzone = ImFloor(LogSliderDeadzone * scale_factor);
1074 TabRounding = ImFloor(TabRounding * scale_factor);
1075 TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImFloor(TabMinWidthForCloseButton * scale_factor) : FLT_MAX;
1076 DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor);
1077 DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor);
1078 MouseCursorScale = ImFloor(MouseCursorScale * scale_factor);
1079}
1080
1081ImGuiIO::ImGuiIO()
1082{

Callers 1

resetStyleFunction · 0.80

Calls 1

ImFloorFunction · 0.85

Tested by

no test coverage detected