summaryrefslogtreecommitdiff
path: root/src/dock_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2014-09-22 08:01:25 +0000
committerpeter1138 <peter1138@openttd.org>2014-09-22 08:01:25 +0000
commit51fe741987da095274cd3782ff62371a1126ddb8 (patch)
treeb6b85bfe28aeff152bbb373d07d615641fc65690 /src/dock_gui.cpp
parent26239c3d89327d2b94210097f90ae3c6dba3dbc7 (diff)
downloadopenttd-51fe741987da095274cd3782ff62371a1126ddb8.tar.xz
(svn r26906) -Codechange: Scale depot and station picker buttons by GUI zoom level.
Diffstat (limited to 'src/dock_gui.cpp')
-rw-r--r--src/dock_gui.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 94b735573..cd994bc0b 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -26,6 +26,7 @@
#include "company_base.h"
#include "hotkeys.h"
#include "gui.h"
+#include "zoom_func.h"
#include "widgets/dock_widget.h"
@@ -498,14 +499,30 @@ public:
UpdateDocksDirection();
}
+ virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ {
+ switch (widget) {
+ case WID_BDD_X:
+ case WID_BDD_Y:
+ size->width = UnScaleByZoom(96 * 4, ZOOM_LVL_GUI) + 2;
+ size->height = UnScaleByZoom(64 * 4, ZOOM_LVL_GUI) + 2;
+ break;
+ }
+ }
+
virtual void OnPaint()
{
this->DrawWidgets();
- DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + 64, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + 18, AXIS_X, DEPOT_PART_NORTH);
- DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + 32, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + 34, AXIS_X, DEPOT_PART_SOUTH);
- DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + 32, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + 18, AXIS_Y, DEPOT_PART_NORTH);
- DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + 64, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + 34, AXIS_Y, DEPOT_PART_SOUTH);
+ int x1 = UnScaleByZoom(63 * 4, ZOOM_LVL_GUI) + 1;
+ int x2 = UnScaleByZoom(31 * 4, ZOOM_LVL_GUI) + 1;
+ int y1 = UnScaleByZoom(17 * 4, ZOOM_LVL_GUI) + 1;
+ int y2 = UnScaleByZoom(33 * 4, ZOOM_LVL_GUI) + 1;
+
+ DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + x1, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + y1, AXIS_X, DEPOT_PART_NORTH);
+ DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + x2, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + y2, AXIS_X, DEPOT_PART_SOUTH);
+ DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + x2, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + y1, AXIS_Y, DEPOT_PART_NORTH);
+ DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + x1, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + y2, AXIS_Y, DEPOT_PART_SOUTH);
}
virtual void OnClick(Point pt, int widget, int click_count)