1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-01 19:25:12 +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

@@ -235,26 +235,28 @@ static void window_clear_scenery_invalidate(rct_window* w)
*/
static void window_clear_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
int32_t x, y;
window_draw_widgets(w, dpi);
// Draw number for tool sizes bigger than 7
x = w->windowPos.x
+ (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2;
y = w->windowPos.y
+ (window_clear_scenery_widgets[WIDX_PREVIEW].top + window_clear_scenery_widgets[WIDX_PREVIEW].bottom) / 2;
ScreenCoordsXY screenCoords = {
w->windowPos.x
+ (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2,
w->windowPos.y
+ (window_clear_scenery_widgets[WIDX_PREVIEW].top + window_clear_scenery_widgets[WIDX_PREVIEW].bottom) / 2
};
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
{
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize);
gfx_draw_string_centred(
dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize);
}
// Draw cost amount
if (gClearSceneryCost != MONEY32_UNDEFINED && gClearSceneryCost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY))
{
x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2
screenCoords.x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right)
/ 2
+ w->windowPos.x;
y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 5 + 27;
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, &gClearSceneryCost);
screenCoords.y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 5 + 27;
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gClearSceneryCost);
}
}