1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 14:02:59 +01:00

Fix #11570 - create gfx_draw_string_centered() overload (#11760)

* Fix #11570 - create gfx_draw_string_centered() overload

I created the overload, updated all calls from the old function to the new and deleted the old one
This commit is contained in:
TomasZilinek
2020-05-17 20:29:56 +02:00
committed by GitHub
parent e87343f9c6
commit 277080de74
20 changed files with 171 additions and 161 deletions

View File

@@ -596,6 +596,7 @@ static void window_footpath_invalidate(rct_window* w)
*/
static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
ScreenCoordsXY screenCoords;
window_draw_widgets(w, dpi);
if (!(w->disabled_widgets & (1 << WIDX_CONSTRUCT)))
@@ -618,26 +619,29 @@ static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi)
image += pathType->image;
// Draw construction image
int32_t x = w->windowPos.x
+ (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
int32_t y = w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60;
gfx_draw_sprite(dpi, image, x, y, 0);
screenCoords = {
w->windowPos.x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2,
w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60
};
gfx_draw_sprite(dpi, image, screenCoords.x, screenCoords.y, 0);
// Draw build this... label
x = w->windowPos.x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
y = w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23;
gfx_draw_string_centred(dpi, STR_BUILD_THIS, x, y, COLOUR_BLACK, nullptr);
screenCoords = {
w->windowPos.x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2,
w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23
};
gfx_draw_string_centred(dpi, STR_BUILD_THIS, screenCoords, COLOUR_BLACK, nullptr);
}
// Draw cost
int32_t x = w->windowPos.x
screenCoords.x = w->windowPos.x
+ (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
int32_t y = w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12;
screenCoords.y = w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12;
if (_window_footpath_cost != MONEY32_UNDEFINED)
{
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
{
gfx_draw_string_centred(dpi, STR_COST_LABEL, x, y, COLOUR_BLACK, &_window_footpath_cost);
gfx_draw_string_centred(dpi, STR_COST_LABEL, screenCoords, COLOUR_BLACK, &_window_footpath_cost);
}
}
}