summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2021-04-09 20:39:56 +0200
committerNiels Martin Hansen <nielsm@indvikleren.dk>2021-09-12 19:46:48 +0200
commit6bd3106681edef38010472ba341e4b552ab2ef55 (patch)
tree0bc26cf363fcff891433b15526c23a3181c1f1a0 /src/main_gui.cpp
parent710b758b81f69a6f6771d7e8741db819831731e6 (diff)
downloadopenttd-6bd3106681edef38010472ba341e4b552ab2ef55.tar.xz
Feature: Multiple rotating views on title screen
Diffstat (limited to 'src/main_gui.cpp')
-rw-r--r--src/main_gui.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 79960d51b..944a28405 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -152,12 +152,24 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w)
}
}
-void FixTitleGameZoom()
+void FixTitleGameZoom(int zoom_adjust)
{
if (_game_mode != GM_MENU) return;
Viewport *vp = FindWindowByClass(WC_MAIN_WINDOW)->viewport;
+
+ /* Adjust the zoom in/out.
+ * Can't simply add, since operator+ is not defined on the ZoomLevel type. */
vp->zoom = _gui_zoom;
+ while (zoom_adjust < 0 && vp->zoom != ZOOM_LVL_MIN) {
+ vp->zoom--;
+ zoom_adjust++;
+ }
+ while (zoom_adjust > 0 && vp->zoom != ZOOM_LVL_MAX) {
+ vp->zoom++;
+ zoom_adjust--;
+ }
+
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
}