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.
| 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. |
| 1156 | void 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 | |
| 1183 | ImGuiIO::ImGuiIO() |
| 1184 | { |