Fix #9995: Adjust viewport zoom level for HiDPI displays

On HiDPI screens the zoom level is increased for detailed rendering. This causes hard-coded zoom levels to be off by this adjustment. To fix these default zoom levels, we scale the zoom level based on `_gui_zoom` to get the scaled zoom level.
This commit is contained in:
Bouke Haarsma
2022-09-04 08:55:03 +02:00
committed by Michael Lutz
parent 47a998fb0c
commit 93d2d4590f
9 changed files with 31 additions and 9 deletions

View File

@@ -40,6 +40,7 @@
#include "table/strings.h"
#include "safeguards.h"
#include "zoom_func.h"
TownKdtree _town_local_authority_kdtree(&Kdtree_TownXYFunc);
@@ -331,7 +332,7 @@ public:
this->flags |= WF_DISABLE_VP_SCROLL;
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_TV_VIEWPORT);
nvp->InitializeViewport(this, this->town->xy, ZOOM_LVL_NEWS);
nvp->InitializeViewport(this, this->town->xy, ScaleZoomGUI(ZOOM_LVL_TOWN));
/* disable renaming town in network games if you are not the server */
this->SetWidgetDisabledState(WID_TV_CHANGE_NAME, _networking && !_network_server);