MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / ScaleAllSizes

Method ScaleAllSizes

extern/imgui/imgui.cpp:1156–1181  ·  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

1154// 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.
1155// 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.
1156void ImGuiStyle::ScaleAllSizes(float scale_factor)
1157{
1158 WindowPadding = ImFloor(WindowPadding * scale_factor);
1159 WindowRounding = ImFloor(WindowRounding * scale_factor);
1160 WindowMinSize = ImFloor(WindowMinSize * scale_factor);
1161 ChildRounding = ImFloor(ChildRounding * scale_factor);
1162 PopupRounding = ImFloor(PopupRounding * scale_factor);
1163 FramePadding = ImFloor(FramePadding * scale_factor);
1164 FrameRounding = ImFloor(FrameRounding * scale_factor);
1165 ItemSpacing = ImFloor(ItemSpacing * scale_factor);
1166 ItemInnerSpacing = ImFloor(ItemInnerSpacing * scale_factor);
1167 CellPadding = ImFloor(CellPadding * scale_factor);
1168 TouchExtraPadding = ImFloor(TouchExtraPadding * scale_factor);
1169 IndentSpacing = ImFloor(IndentSpacing * scale_factor);
1170 ColumnsMinSpacing = ImFloor(ColumnsMinSpacing * scale_factor);
1171 ScrollbarSize = ImFloor(ScrollbarSize * scale_factor);
1172 ScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor);
1173 GrabMinSize = ImFloor(GrabMinSize * scale_factor);
1174 GrabRounding = ImFloor(GrabRounding * scale_factor);
1175 LogSliderDeadzone = ImFloor(LogSliderDeadzone * scale_factor);
1176 TabRounding = ImFloor(TabRounding * scale_factor);
1177 TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImFloor(TabMinWidthForCloseButton * scale_factor) : FLT_MAX;
1178 DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor);
1179 DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor);
1180 MouseCursorScale = ImFloor(MouseCursorScale * scale_factor);
1181}
1182
1183ImGuiIO::ImGuiIO()
1184{

Callers 1

initStyleMethod · 0.80

Calls 1

ImFloorFunction · 0.85

Tested by

no test coverage detected