mirror of https://github.com/OpenTTD/OpenTTD
Fix: Signals were incorrectly shifted by 1 pixel when selected. (#12005)
Most shifting when pressed was removed by 884b9e66
.
pull/12011/head
parent
63708609fb
commit
09a12f230f
|
@ -1693,12 +1693,9 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw dynamic a signal-sprite in a button in the signal GUI
|
* Draw dynamic a signal-sprite in a button in the signal GUI
|
||||||
* Draw the sprite +1px to the right and down if the button is lowered
|
|
||||||
*
|
|
||||||
* @param widget_index index of this widget in the window
|
|
||||||
* @param image the sprite to draw
|
* @param image the sprite to draw
|
||||||
*/
|
*/
|
||||||
void DrawSignalSprite(const Rect &r, WidgetID widget_index, SpriteID image) const
|
void DrawSignalSprite(const Rect &r, SpriteID image) const
|
||||||
{
|
{
|
||||||
Point offset;
|
Point offset;
|
||||||
Dimension sprite_size = GetSpriteSize(image, &offset);
|
Dimension sprite_size = GetSpriteSize(image, &offset);
|
||||||
|
@ -1707,9 +1704,7 @@ private:
|
||||||
int y = ir.top - sig_sprite_bottom_offset +
|
int y = ir.top - sig_sprite_bottom_offset +
|
||||||
(ir.Height() + sig_sprite_size.height) / 2; // aligned to bottom
|
(ir.Height() + sig_sprite_size.height) / 2; // aligned to bottom
|
||||||
|
|
||||||
DrawSprite(image, PAL_NONE,
|
DrawSprite(image, PAL_NONE, x, y);
|
||||||
x + this->IsWidgetLowered(widget_index),
|
|
||||||
y + this->IsWidgetLowered(widget_index));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Show or hide buttons for non-path signals in the signal GUI */
|
/** Show or hide buttons for non-path signals in the signal GUI */
|
||||||
|
@ -1786,7 +1781,7 @@ public:
|
||||||
int var = SIG_SEMAPHORE - (widget - WID_BS_SEMAPHORE_NORM) / SIGTYPE_END; // SignalVariant order is reversed compared to the widgets.
|
int var = SIG_SEMAPHORE - (widget - WID_BS_SEMAPHORE_NORM) / SIGTYPE_END; // SignalVariant order is reversed compared to the widgets.
|
||||||
SpriteID sprite = GetRailTypeInfo(_cur_railtype)->gui_sprites.signals[type][var][this->IsWidgetLowered(widget)];
|
SpriteID sprite = GetRailTypeInfo(_cur_railtype)->gui_sprites.signals[type][var][this->IsWidgetLowered(widget)];
|
||||||
|
|
||||||
this->DrawSignalSprite(r, widget, sprite);
|
this->DrawSignalSprite(r, sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue