* Resolve GUI zoom level, if auto-suggestion is requested. */
| 1788 | * Resolve GUI zoom level, if auto-suggestion is requested. |
| 1789 | */ |
| 1790 | void UpdateGUIZoom() |
| 1791 | { |
| 1792 | /* Determine real GUI zoom to use. */ |
| 1793 | if (_gui_scale_cfg == -1) { |
| 1794 | /* Minimum design size of the game is 640x480. */ |
| 1795 | float xs = _screen.width / 640.f; |
| 1796 | float ys = _screen.height / 480.f; |
| 1797 | int scale = std::min(xs, ys) * 100; |
| 1798 | /* Round down scaling to 25% increments and clamp to limits. */ |
| 1799 | _gui_scale = Clamp((scale / 25) * 25, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE); |
| 1800 | } else { |
| 1801 | _gui_scale = Clamp(_gui_scale_cfg, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE); |
| 1802 | } |
| 1803 | |
| 1804 | ZoomLevel new_zoom = ScaleGUITrad(1) <= 1 ? ZoomLevel::Normal : ScaleGUITrad(1) >= 4 ? ZoomLevel::In4x : ZoomLevel::In2x; |
| 1805 | /* Font glyphs should not be clamped to min/max zoom. */ |
| 1806 | _font_zoom = new_zoom; |
| 1807 | /* Ensure the gui_zoom is clamped between min/max. */ |
| 1808 | new_zoom = Clamp(new_zoom, _settings_client.gui.zoom_min, _settings_client.gui.zoom_max); |
| 1809 | _gui_zoom = new_zoom; |
| 1810 | } |
| 1811 | |
| 1812 | /** |
| 1813 | * Resolve GUI zoom level and adjust GUI to new zoom, if auto-suggestion is requested. |
no test coverage detected