MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / FixTitleGameZoom

Function FixTitleGameZoom

src/main_gui.cpp:158–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void FixTitleGameZoom(int zoom_adjust)
159{
160 if (_game_mode != GM_MENU) return;
161
162 Viewport &vp = *GetMainWindow()->viewport;
163
164 /* Adjust the zoom in/out.
165 * Can't simply add, since operator+ is not defined on the ZoomLevel type. */
166 vp.zoom = _gui_zoom;
167 while (zoom_adjust < 0 && vp.zoom != _settings_client.gui.zoom_min) {
168 vp.zoom--;
169 zoom_adjust++;
170 }
171 while (zoom_adjust > 0 && vp.zoom != _settings_client.gui.zoom_max) {
172 vp.zoom++;
173 zoom_adjust--;
174 }
175
176 vp.virtual_width = ScaleByZoom(vp.width, vp.zoom);
177 vp.virtual_height = ScaleByZoom(vp.height, vp.zoom);
178}
179
180static constexpr std::initializer_list<NWidgetPart> _nested_main_window_widgets = {
181 NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1),

Callers 2

OnRealtimeTickMethod · 0.85
LoadIntroGameFunction · 0.85

Calls 2

GetMainWindowFunction · 0.85
ScaleByZoomFunction · 0.85

Tested by

no test coverage detected