center watch button sprite in toolbar
This commit is contained in:
@@ -548,6 +548,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
|
||||
case WID_ROT_FULLROAD:
|
||||
HandlePlacePushButton(this, WID_ROT_FULLROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT);
|
||||
// IConsolePrintF(CC_WARNING, "WARNING! Full-tile autoroad tool is deprecated and will be removed in next release.");
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
|
||||
@@ -1778,6 +1778,14 @@ struct MainToolbarWindow : Window {
|
||||
this->DrawWidgets();
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const {
|
||||
if (widget == WID_TN_WATCH) {
|
||||
Dimension d = GetSpriteSize(SPR_CENTRE_VIEW_VEHICLE);
|
||||
uint offset = this->IsWidgetLowered(WID_TN_WATCH) ? 1 : 0;
|
||||
DrawSprite(SPR_CENTRE_VIEW_VEHICLE, PAL_NONE, (r.left + r.right - d.width) / 2 + offset, (r.top + r.bottom - d.height) / 2 + offset);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
{
|
||||
if (_game_mode != GM_MENU && !this->IsWidgetDisabled(widget)) _toolbar_button_procs[widget](this);
|
||||
@@ -2006,7 +2014,7 @@ static NWidgetBase *MakeMainToolbar(int *biggest_index)
|
||||
SPR_IMG_COMPANY_GENERAL, // WID_TN_COMPANIES
|
||||
SPR_IMG_STORY_BOOK, // WID_TN_STORY
|
||||
SPR_IMG_GOAL, // WID_TN_GOAL
|
||||
SPR_CENTRE_VIEW_VEHICLE, // WID_TN_WATCH
|
||||
0, // WID_TN_WATCH
|
||||
SPR_IMG_GRAPHS, // WID_TN_GRAPHS
|
||||
SPR_IMG_COMPANY_LEAGUE, // WID_TN_LEAGUE
|
||||
SPR_IMG_INDUSTRY, // WID_TN_INDUSTRIES
|
||||
|
||||
@@ -217,8 +217,9 @@ void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, Fra
|
||||
*/
|
||||
static inline void DrawImageButtons(const Rect &r, WidgetType type, Colours colour, bool clicked, SpriteID img)
|
||||
{
|
||||
assert(img != 0);
|
||||
|
||||
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE);
|
||||
if (img == 0) return;
|
||||
|
||||
if ((type & WWT_MASK) == WWT_IMGBTN_2 && clicked) img++; // Show different image when clicked for #WWT_IMGBTN_2.
|
||||
DrawSprite(img, PAL_NONE, r.left + WD_IMGBTN_LEFT + clicked, r.top + WD_IMGBTN_TOP + clicked);
|
||||
|
||||
Reference in New Issue
Block a user