1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 21:43:06 +01:00

Introduce widget::midX and widget::midY helper functions

This commit is contained in:
Aaron van Geffen
2020-06-25 10:31:15 +02:00
parent 681b8d7938
commit 2e153a7e95
25 changed files with 61 additions and 84 deletions

View File

@@ -620,23 +620,20 @@ static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Draw construction image
screenCoords = w->windowPos
+ ScreenCoordsXY{ (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right)
/ 2,
+ ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(),
window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60 };
gfx_draw_sprite(dpi, image, screenCoords, 0);
// Draw build this... label
screenCoords = w->windowPos
+ ScreenCoordsXY{ (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right)
/ 2,
+ ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(),
window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23 };
gfx_draw_string_centred(dpi, STR_BUILD_THIS, screenCoords, COLOUR_BLACK, nullptr);
}
// Draw cost
screenCoords = w->windowPos
+ ScreenCoordsXY{ (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2,
window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12 };
+ ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(), window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12 };
if (_window_footpath_cost != MONEY32_UNDEFINED)
{
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))