summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Nelson <peter@fuzzle.org>2021-03-15 22:37:35 +0000
committerCharles Pigott <charlespigott@googlemail.com>2021-03-20 17:55:17 +0000
commitb43cc21214cf088131db1fa9c2322d9ab58a1dfb (patch)
tree872e95f8e8dcbd981d3908e61f5fd3c10bec0470 /src
parent1893aef649758749b6d9b4267bbeea299762ab79 (diff)
downloadopenttd-b43cc21214cf088131db1fa9c2322d9ab58a1dfb.tar.xz
Fix: OSK layout not scaled for 2x or 4x GUI scale.
Diffstat (limited to 'src')
-rw-r--r--src/osk_gui.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index 45ff2d238..60c9023b8 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -15,6 +15,7 @@
#include "gfx_func.h"
#include "querystring_gui.h"
#include "video/video_driver.hpp"
+#include "zoom_func.h"
#include "widgets/osk_widget.h"
@@ -103,8 +104,8 @@ struct OskWindow : public Window {
widget -= WID_OSK_LETTERS;
DrawCharCentered(_keyboard[this->shift][widget],
- r.left + 8,
- r.top + 3,
+ r.left + (r.right - r.left) / 2,
+ r.top + (r.bottom - r.top - FONT_HEIGHT_NORMAL) / 2,
TC_BLACK);
}
@@ -231,15 +232,15 @@ static void AddKey(NWidgetHorizontal *hor, int height, int num_half, WidgetType
if (widtype == NWID_SPACER) {
if (!hor->IsEmpty()) key_width += INTER_KEY_SPACE;
- NWidgetSpacer *spc = new NWidgetSpacer(key_width, height);
+ NWidgetSpacer *spc = new NWidgetSpacer(ScaleGUITrad(key_width), height);
hor->Add(spc);
} else {
if (!hor->IsEmpty()) {
- NWidgetSpacer *spc = new NWidgetSpacer(INTER_KEY_SPACE, height);
+ NWidgetSpacer *spc = new NWidgetSpacer(ScaleGUITrad(INTER_KEY_SPACE), height);
hor->Add(spc);
}
NWidgetLeaf *leaf = new NWidgetLeaf(widtype, COLOUR_GREY, widnum, widdata, STR_NULL);
- leaf->SetMinimalSize(key_width, height);
+ leaf->SetMinimalSize(ScaleGUITrad(key_width), height);
hor->Add(leaf);
}