center watch button sprite in toolbar

This commit is contained in:
Pavel Stupnikov
2015-11-13 03:42:13 +03:00
parent 88eecbe03e
commit d6c3955c8c
3 changed files with 12 additions and 2 deletions

View File

@@ -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);