diff --git a/src/openrct2-ui/interface/Graph.cpp b/src/openrct2-ui/interface/Graph.cpp index 596b6e041f..df0e547a0a 100644 --- a/src/openrct2-ui/interface/Graph.cpp +++ b/src/openrct2-ui/interface/Graph.cpp @@ -29,7 +29,7 @@ namespace Graph // Draw month text auto ft = Formatter(); ft.Add(DateGameShortMonthNames[date_get_month((yearOver32 / 4) + MONTH_COUNT)]); - gfx_draw_string_centred(dpi, STR_GRAPH_LABEL, screenCoords - ScreenCoordsXY{ 0, 10 }, COLOUR_BLACK, ft.Data()); + DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 10 }, STR_GRAPH_LABEL, ft, { TextAlignment::CENTRE }); // Draw month mark gfx_fill_rect(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_10); @@ -170,8 +170,8 @@ namespace Graph { // Draw month text int32_t monthFormat = DateGameShortMonthNames[date_get_month((yearOver32 / 4) + MONTH_COUNT)]; - gfx_draw_string_centred( - dpi, STR_GRAPH_LABEL, screenCoords - ScreenCoordsXY{ 0, 10 }, COLOUR_BLACK, &monthFormat); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 10 }, STR_GRAPH_LABEL, &monthFormat, { TextAlignment::CENTRE }); // Draw month mark gfx_fill_rect(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_10); @@ -273,8 +273,9 @@ namespace Graph gfx_draw_dashed_line(dpi, { info.coords, { info.coords.x, cursorPosition.y } }, DefaultDashedLength, 0); } - gfx_draw_string_centred( - dpi, STR_FINANCES_SUMMARY_EXPENDITURE_VALUE, info.coords - ScreenCoordsXY{ 0, 16 }, COLOUR_BLACK, &info.money); + DrawTextBasic( + dpi, info.coords - ScreenCoordsXY{ 0, 16 }, STR_FINANCES_SUMMARY_EXPENDITURE_VALUE, &info.money, + { TextAlignment::CENTRE }); gfx_fill_rect( dpi, { { info.coords - ScreenCoordsXY{ 2, 2 } }, info.coords + ScreenCoordsXY{ 2, 2 } }, PALETTE_INDEX_10); diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 0bce3c1194..099a89c991 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -710,7 +710,7 @@ void CustomListView::PaintSeperator( // Draw string Formatter ft; ft.Add(text); - gfx_draw_string_centred(dpi, STR_STRING, { centreX, pos.y }, baseColour, ft.Data()); + DrawTextBasic(dpi, { centreX, pos.y }, STR_STRING, ft.Data(), { baseColour, TextAlignment::CENTRE }); // Get string dimensions format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_STRING, ft.Data()); diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index d94726db47..bcc3cbd832 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -273,23 +273,23 @@ static void window_about_rct2_paint(rct_window* w, rct_drawpixelinfo* dpi) int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM); // Credits - gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_COPYRIGHT_CS, {}, { TextAlignment::CENTRE }); screenCoords.y += lineHeight + 74; - gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_DESIGNED_AND_PROGRAMMED_BY_CS, {}, { TextAlignment::CENTRE }); screenCoords.y += lineHeight; - gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_GRAPHICS_BY_SF, {}, { TextAlignment::CENTRE }); screenCoords.y += lineHeight; - gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_SOUND_AND_MUSIC_BY_AB, {}, { TextAlignment::CENTRE }); screenCoords.y += lineHeight; - gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, {}, { TextAlignment::CENTRE }); screenCoords.y += lineHeight + 3; - gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_REPRESENTATION_BY_JL, {}, { TextAlignment::CENTRE }); screenCoords.y += 2 * lineHeight + 5; - gfx_draw_string_centred(dpi, STR_THANKS_TO, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_THANKS_TO, {}, { TextAlignment::CENTRE }); screenCoords.y += lineHeight; - gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_THANKS_TO_PEOPLE, {}, { TextAlignment::CENTRE }); screenCoords.y += 2 * lineHeight + 5; - gfx_draw_string_centred(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, {}, { TextAlignment::CENTRE }); // Images gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, { w->windowPos.x + 92, yPage + 24 }, 0); diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 79da7d9cb4..d4ee3ed454 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -222,8 +222,8 @@ static void window_clear_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi) w->windowPos.y + window_clear_scenery_widgets[WIDX_PREVIEW].midY() }; if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE) { - gfx_draw_string_centred( - dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize, { TextAlignment::CENTRE }); } // Draw cost amount @@ -231,6 +231,6 @@ static void window_clear_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi) { screenCoords.x = window_clear_scenery_widgets[WIDX_PREVIEW].midX() + w->windowPos.x; 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); + DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, &gClearSceneryCost, { TextAlignment::CENTRE }); } } diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index ea2934e76b..86ee4d289f 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -434,9 +434,9 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) / 2 + w->windowPos.x; int16_t stateY = w->height - 0x0C + w->windowPos.y; - gfx_draw_string_centred( - dpi, EditorStepNames[EnumValue(gS6Info.editor_step)], { stateX, stateY }, - NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE, nullptr); + DrawTextBasic( + dpi, { stateX, stateY }, EditorStepNames[EnumValue(gS6Info.editor_step)], {}, + { static_cast(NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE), TextAlignment::CENTRE }); if (drawPreviousButton) { @@ -447,7 +447,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 }, 0); - int32_t textColour = NOT_TRANSLUCENT(w->colours[1]); + colour_t textColour = NOT_TRANSLUCENT(w->colours[1]); if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON) { @@ -464,8 +464,8 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; - gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, { textX, textY }, textColour, nullptr); - gfx_draw_string_centred(dpi, stringId, { textX, textY + 10 }, textColour, nullptr); + DrawTextBasic(dpi, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::CENTRE }); + DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); } if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EditorStep::RollercoasterDesigner) @@ -477,7 +477,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 }, 0); - int32_t textColour = NOT_TRANSLUCENT(w->colours[1]); + colour_t textColour = NOT_TRANSLUCENT(w->colours[1]); if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON) { @@ -494,8 +494,8 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; - gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, { textX, textY }, textColour, nullptr); - gfx_draw_string_centred(dpi, stringId, { textX, textY + 10 }, textColour, nullptr); + DrawTextBasic(dpi, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::CENTRE }); + DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); } } } diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index bd7c1a68c6..0225b2139a 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -618,7 +618,7 @@ static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi) screenCoords = w->windowPos + 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); + DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); } // Draw cost @@ -628,7 +628,7 @@ static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi) { if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { - gfx_draw_string_centred(dpi, STR_COST_LABEL, screenCoords, COLOUR_BLACK, &_window_footpath_cost); + DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, &_window_footpath_cost, { TextAlignment::CENTRE }); } } } diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index f9a8113593..c7d7d1fc34 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -406,14 +406,14 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo* dpi, r auto screenCoords = ScreenCoordsXY{ w->windowPos.x + widget.midX(), w->windowPos.y + widget.midY() - (line_height == 10 ? 5 : 6) }; + colour_t colour + = (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_MONEY + ? COLOUR_WHITE + : NOT_TRANSLUCENT(w->colours[0])); + rct_string_id stringId = gCash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH; auto ft = Formatter(); ft.Add(gCash); - gfx_draw_string_centred( - dpi, (gCash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH), screenCoords, - (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_MONEY - ? COLOUR_WHITE - : NOT_TRANSLUCENT(w->colours[0])), - ft.Data()); + DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); } static constexpr const rct_string_id guestCountFormats[] = { @@ -433,14 +433,15 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo* dpi, r rct_widget widget = window_game_bottom_toolbar_widgets[WIDX_GUESTS]; auto screenCoords = ScreenCoordsXY{ w->windowPos.x + widget.midX(), w->windowPos.y + widget.midY() - 6 }; - gfx_draw_string_centred( - dpi, - gNumGuestsInPark == 1 ? guestCountFormatsSingular[gGuestChangeModifier] : guestCountFormats[gGuestChangeModifier], - screenCoords, - (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_GUESTS - ? COLOUR_WHITE - : NOT_TRANSLUCENT(w->colours[0])), - &gNumGuestsInPark); + rct_string_id stringId = gNumGuestsInPark == 1 ? guestCountFormatsSingular[gGuestChangeModifier] + : guestCountFormats[gGuestChangeModifier]; + colour_t colour + = (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_GUESTS + ? COLOUR_WHITE + : NOT_TRANSLUCENT(w->colours[0])); + auto ft = Formatter(); + ft.Add(gNumGuestsInPark); + DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); } // Draw park rating @@ -495,17 +496,16 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo* dpi, int32_t month = date_get_month(gDateMonthsElapsed); int32_t day = ((gDateMonthTicks * days_in_month[month]) >> 16) & 0xFF; + colour_t colour + = (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_DATE + ? COLOUR_WHITE + : NOT_TRANSLUCENT(w->colours[0])); rct_string_id stringId = DateFormatStringFormatIds[gConfigGeneral.date_format]; auto ft = Formatter(); ft.Add(DateDayNames[day]); ft.Add(month); ft.Add(year); - gfx_draw_string_centred( - dpi, stringId, screenCoords, - (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_DATE - ? COLOUR_WHITE - : NOT_TRANSLUCENT(w->colours[0])), - ft.Data()); + DrawTextBasic(dpi, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); // Figure out how much line height we have to work with. uint32_t line_height = font_get_line_height(FontSpriteBase::MEDIUM); diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 4d26ae87a0..6aa745e6f4 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -328,8 +328,8 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi) if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE) { screenCoords = { w->windowPos.x + previewWidget->midX(), w->windowPos.y + previewWidget->midY() }; - gfx_draw_string_centred( - dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize, { TextAlignment::CENTRE }); } else if (gLandMountainMode) { @@ -346,12 +346,12 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi) { // Draw raise cost amount if (gLandToolRaiseCost != MONEY32_UNDEFINED && gLandToolRaiseCost != 0) - gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gLandToolRaiseCost); + DrawTextBasic(dpi, screenCoords, STR_RAISE_COST_AMOUNT, &gLandToolRaiseCost, { TextAlignment::CENTRE }); screenCoords.y += 10; // Draw lower cost amount if (gLandToolLowerCost != MONEY32_UNDEFINED && gLandToolLowerCost != 0) - gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gLandToolLowerCost); + DrawTextBasic(dpi, screenCoords, STR_LOWER_COST_AMOUNT, &gLandToolLowerCost, { TextAlignment::CENTRE }); screenCoords.y += 50; // Draw paint price @@ -375,7 +375,7 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi) { auto ft = Formatter(); ft.Add(price); - gfx_draw_string_centred(dpi, STR_COST_AMOUNT, screenCoords, COLOUR_BLACK, ft.Data()); + DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft.Data(), { TextAlignment::CENTRE }); } } } diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 4c51e4fe95..371c66983d 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -262,8 +262,8 @@ static void window_land_rights_paint(rct_window* w, rct_drawpixelinfo* dpi) // Draw number for tool sizes bigger than 7 if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE) { - gfx_draw_string_centred( - dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize, { TextAlignment::CENTRE }); } // Draw cost amount @@ -271,7 +271,7 @@ static void window_land_rights_paint(rct_window* w, rct_drawpixelinfo* dpi) { screenCoords = { window_land_rights_widgets[WIDX_PREVIEW].midX() + w->windowPos.x, window_land_rights_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 32 }; - gfx_draw_string_centred(dpi, STR_COST_AMOUNT, screenCoords, COLOUR_BLACK, &_landRightsCost); + DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, &_landRightsCost, { TextAlignment::CENTRE }); } } diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index fc29849292..9362f26a3d 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -819,8 +819,9 @@ static void window_map_paint(rct_window* w, rct_drawpixelinfo* dpi) // Draw land tool size if (WidgetIsActiveTool(w, WIDX_SET_LAND_RIGHTS) && _landRightsToolSize > MAX_TOOL_SIZE_WITH_SPRITE) { - gfx_draw_string_centred( - dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &_landRightsToolSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &_landRightsToolSize, + { TextAlignment::CENTRE }); } screenCoords.y = w->windowPos.y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5; diff --git a/src/openrct2-ui/windows/MusicCredits.cpp b/src/openrct2-ui/windows/MusicCredits.cpp index 42697c8e05..642d90ff70 100644 --- a/src/openrct2-ui/windows/MusicCredits.cpp +++ b/src/openrct2-ui/windows/MusicCredits.cpp @@ -164,13 +164,13 @@ static void window_music_credits_scrollpaint(rct_window* w, rct_drawpixelinfo* d for (size_t i = 0; i < std::size(music_credits); i++) { - gfx_draw_string_centred(dpi, music_credits[i], screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, music_credits[i], nullptr, { TextAlignment::CENTRE }); screenCoords.y += lineHeight; } // Add 4 more space before "Original recordings ...". screenCoords.y += 4; - gfx_draw_string_centred(dpi, STR_MUSIC_ACKNOWLEDGEMENTS_ORIGINAL_RECORDINGS, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_MUSIC_ACKNOWLEDGEMENTS_ORIGINAL_RECORDINGS, nullptr, { TextAlignment::CENTRE }); screenCoords.y += lineHeight; // Draw the separator @@ -180,7 +180,7 @@ static void window_music_credits_scrollpaint(rct_window* w, rct_drawpixelinfo* d for (size_t i = 0; i < std::size(music_credits_rct2); i++) { - gfx_draw_string_centred(dpi, music_credits_rct2[i], screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, music_credits_rct2[i], nullptr, { TextAlignment::CENTRE }); screenCoords.y += lineHeight; } } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 7551782297..f3b7d18492 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -2668,9 +2668,9 @@ static void window_ride_main_paint(rct_window* w, rct_drawpixelinfo* dpi) } widget = &window_ride_main_widgets[WIDX_VIEW]; - gfx_draw_string_centred( - dpi, STR_WINDOW_COLOUR_2_STRINGID, - { w->windowPos.x + (widget->left + widget->right - 11) / 2, w->windowPos.y + widget->top }, COLOUR_BLACK, ft.Data()); + DrawTextBasic( + dpi, { w->windowPos.x + (widget->left + widget->right - 11) / 2, w->windowPos.y + widget->top }, + STR_WINDOW_COLOUR_2_STRINGID, ft.Data(), { TextAlignment::CENTRE }); // Status ft = Formatter(); diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 786fd4d861..5f8fe6ab55 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2323,12 +2323,12 @@ static void window_ride_construction_paint(rct_window* w, rct_drawpixelinfo* dpi // Draw cost screenCoords = { w->windowPos.x + widget->midX(), w->windowPos.y + widget->bottom - 23 }; if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_PLACE) - gfx_draw_string_centred(dpi, STR_BUILD_THIS, screenCoords, COLOUR_BLACK, w); + DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, w, { TextAlignment::CENTRE }); screenCoords.y += 11; if (_currentTrackPrice != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { - gfx_draw_string_centred(dpi, STR_COST_LABEL, screenCoords, COLOUR_BLACK, static_cast(&_currentTrackPrice)); + DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, static_cast(&_currentTrackPrice), { TextAlignment::CENTRE }); } } diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 0820056132..44c1964563 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -549,8 +549,6 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi) static void window_scenarioselect_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex) { - int32_t colour; - uint8_t paletteIndex = ColourMapA[w->colours[1]].mid_light; gfx_clear(dpi, paletteIndex); @@ -610,12 +608,12 @@ static void window_scenarioselect_scrollpaint(rct_window* w, rct_drawpixelinfo* auto ft = Formatter(); ft.Add(STR_STRING); ft.Add(buffer); - colour = isDisabled ? w->colours[1] | COLOUR_FLAG_INSET : COLOUR_BLACK; + colour_t colour = isDisabled ? w->colours[1] | COLOUR_FLAG_INSET : COLOUR_BLACK; if (isDisabled) { gCurrentFontSpriteBase = FontSpriteBase::MEDIUM_DARK; } - gfx_draw_string_centred(dpi, format, { wide ? 270 : 210, y + 1 }, colour, ft.Data()); + DrawTextBasic(dpi, { wide ? 270 : 210, y + 1 }, format, ft, { colour, TextAlignment::CENTRE }); // Check if scenario is completed if (isCompleted) @@ -634,8 +632,8 @@ static void window_scenarioselect_scrollpaint(rct_window* w, rct_drawpixelinfo* ft.Add(STR_COMPLETED_BY); ft.Add(STR_STRING); ft.Add(buffer); - gfx_draw_string_centred( - dpi, format, { wide ? 270 : 210, y + scenarioTitleHeight + 1 }, COLOUR_BLACK, ft.Data()); + DrawTextBasic( + dpi, { wide ? 270 : 210, y + scenarioTitleHeight + 1 }, format, ft, { TextAlignment::CENTRE }); } y += scenarioItemHeight; @@ -648,13 +646,13 @@ static void window_scenarioselect_scrollpaint(rct_window* w, rct_drawpixelinfo* static void draw_category_heading( rct_window* w, rct_drawpixelinfo* dpi, int32_t left, int32_t right, int32_t y, rct_string_id stringId) { - uint8_t baseColour = w->colours[1]; - uint8_t lightColour = ColourMapA[baseColour].lighter; - uint8_t darkColour = ColourMapA[baseColour].mid_dark; + colour_t baseColour = w->colours[1]; + colour_t lightColour = ColourMapA[baseColour].lighter; + colour_t darkColour = ColourMapA[baseColour].mid_dark; // Draw string int32_t centreX = (left + right) / 2; - gfx_draw_string_centred(dpi, stringId, { centreX, y }, baseColour, nullptr); + DrawTextBasic(dpi, { centreX, y }, stringId, {}, { baseColour, TextAlignment::CENTRE }); // Get string dimensions utf8* buffer = gCommonStringFormatBuffer; diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index ca077c179c..c7b0c2855d 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -216,7 +216,8 @@ static void window_scenery_scatter_paint(rct_window* w, rct_drawpixelinfo* dpi) { auto preview = window_scenery_scatter_widgets[WIDX_PREVIEW]; auto screenCoords = ScreenCoordsXY{ w->windowPos.x + preview.midX(), w->windowPos.y + preview.midY() }; - gfx_draw_string_centred( - dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gWindowSceneryScatterSize); + DrawTextBasic( + dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gWindowSceneryScatterSize, + { TextAlignment::CENTRE }); } } diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 54282f68fa..cbdeda78e7 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -496,8 +496,9 @@ static void window_track_place_paint(rct_window* w, rct_drawpixelinfo* dpi) // Price if (_window_track_place_last_cost != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { - gfx_draw_string_centred( - dpi, STR_COST_LABEL, w->windowPos + ScreenCoordsXY{ 88, 94 }, COLOUR_BLACK, &_window_track_place_last_cost); + DrawTextBasic( + dpi, w->windowPos + ScreenCoordsXY{ 88, 94 }, STR_COST_LABEL, &_window_track_place_last_cost, + { TextAlignment::CENTRE }); } } diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index e0fdfc73e9..fb223ea436 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -146,8 +146,9 @@ public: // Draw number for tool sizes bigger than 7 if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE) { - gfx_draw_string_centred( - &dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize); + DrawTextBasic( + &dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize, + { TextAlignment::CENTRE }); } if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) @@ -157,14 +158,14 @@ public: window_water_widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 }; if (gWaterToolRaiseCost != MONEY32_UNDEFINED && gWaterToolRaiseCost != 0) { - gfx_draw_string_centred(&dpi, STR_RAISE_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gWaterToolRaiseCost); + DrawTextBasic(&dpi, screenCoords, STR_RAISE_COST_AMOUNT, &gWaterToolRaiseCost, { TextAlignment::CENTRE }); } screenCoords.y += 10; // Draw lower cost amount if (gWaterToolLowerCost != MONEY32_UNDEFINED && gWaterToolLowerCost != 0) { - gfx_draw_string_centred(&dpi, STR_LOWER_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gWaterToolLowerCost); + DrawTextBasic(&dpi, screenCoords, STR_LOWER_COST_AMOUNT, &gWaterToolLowerCost, { TextAlignment::CENTRE }); } } } diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 85793aedba..61ad38ee22 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -742,9 +742,6 @@ void gfx_draw_string_no_formatting( /** @deprecated */ void gfx_draw_string_left( rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords); -/** @deprecated */ -void gfx_draw_string_centred( - rct_drawpixelinfo* dpi, rct_string_id format, const ScreenCoordsXY& coords, uint8_t colour, const void* args); int32_t gfx_draw_string_left_wrapped( rct_drawpixelinfo* dpi, void* args, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, uint8_t colour); diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index 7d30a51174..be211b7cd5 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -163,12 +163,6 @@ void gfx_draw_string_left( DrawTextBasic(dpi, coords, format, args, { colour, TextAlignment::LEFT }); } -void gfx_draw_string_centred( - rct_drawpixelinfo* dpi, rct_string_id format, const ScreenCoordsXY& coords, uint8_t colour, const void* args) -{ - DrawTextBasic(dpi, coords, format, args, { colour, TextAlignment::CENTRE }); -} - // Wrapping int32_t gfx_draw_string_left_wrapped( rct_drawpixelinfo* dpi, void* args, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, uint8_t colour) diff --git a/src/openrct2/object/MusicObject.cpp b/src/openrct2/object/MusicObject.cpp index 379fa8abc0..825ef6098c 100644 --- a/src/openrct2/object/MusicObject.cpp +++ b/src/openrct2/object/MusicObject.cpp @@ -48,7 +48,7 @@ void MusicObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t hei // Write (no image) int32_t x = width / 2; int32_t y = height / 2; - gfx_draw_string_centred(dpi, STR_WINDOW_NO_IMAGE, { x, y }, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE }); } void MusicObject::ReadJson(IReadObjectContext* context, json_t& root) diff --git a/src/openrct2/object/WaterObject.cpp b/src/openrct2/object/WaterObject.cpp index 1a475c3101..0ea6ff11a8 100644 --- a/src/openrct2/object/WaterObject.cpp +++ b/src/openrct2/object/WaterObject.cpp @@ -52,7 +52,7 @@ void WaterObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t hei { // Write (no image) auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; - gfx_draw_string_centred(dpi, STR_WINDOW_NO_IMAGE, screenCoords, COLOUR_BLACK, nullptr); + DrawTextBasic(dpi, screenCoords, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE }); } void WaterObject::ReadJson([[maybe_unused]] IReadObjectContext* context, json_t& root)