From dab714d4a6a0325d0c09f00a909c8727f656a726 Mon Sep 17 00:00:00 2001 From: Harry-Hopkinson Date: Thu, 9 May 2024 15:40:51 +0000 Subject: [PATCH] Replace GfxDrawString() with DrawText() --- src/openrct2-ui/interface/InGameConsole.cpp | 2 +- src/openrct2-ui/interface/Widget.cpp | 15 +++++++-------- src/openrct2-ui/scripting/ScGraphicsContext.hpp | 3 +-- src/openrct2-ui/windows/Changelog.cpp | 3 +-- src/openrct2-ui/windows/CustomCurrency.cpp | 4 +--- src/openrct2-ui/windows/EditorObjectSelection.cpp | 7 +++---- .../windows/EditorObjectiveOptions.cpp | 7 +++---- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2-ui/windows/Multiplayer.cpp | 9 ++++----- src/openrct2-ui/windows/NetworkStatus.cpp | 3 +-- src/openrct2-ui/windows/ObjectLoadError.cpp | 2 +- src/openrct2-ui/windows/Player.cpp | 3 +-- src/openrct2-ui/windows/ServerList.cpp | 3 +-- src/openrct2-ui/windows/Themes.cpp | 8 ++++---- src/openrct2-ui/windows/TileInspector.cpp | 8 ++++---- src/openrct2/drawing/Drawing.String.cpp | 12 +++++------- src/openrct2/drawing/Drawing.h | 2 -- src/openrct2/drawing/Text.cpp | 5 ----- src/openrct2/interface/Chat.cpp | 2 +- src/openrct2/paint/Painter.cpp | 5 ++--- src/openrct2/scenes/title/TitleScene.cpp | 5 ++--- 21 files changed, 44 insertions(+), 66 deletions(-) diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index 9e483837b6..4c412faaee 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -323,7 +323,7 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const { const size_t index = i + _consoleScrollPos; lineBuffer = _colourFormatStr + _consoleLines[index]; - GfxDrawString(dpi, screenCoords, lineBuffer.c_str(), { textColour, InGameConsoleGetFontStyle() }); + DrawText(dpi, screenCoords, { textColour, InGameConsoleGetFontStyle() }, lineBuffer.c_str()); screenCoords.y += lineHeight; } diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 1860570802..c2f31668f7 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -643,9 +642,9 @@ static void WidgetCheckboxDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex wi // fill it when checkbox is pressed if (WidgetIsPressed(w, widgetIndex)) { - GfxDrawString( - dpi, { midLeft - ScreenCoordsXY{ 0, 5 } }, static_cast(CheckBoxMarkString), - { static_cast(NOT_TRANSLUCENT(colour)) }); + DrawText( + dpi, { midLeft - ScreenCoordsXY{ 0, 5 } }, { static_cast(NOT_TRANSLUCENT(colour)) }, + static_cast(CheckBoxMarkString)); } // draw the text @@ -745,7 +744,7 @@ static void WidgetHScrollbarDraw( uint8_t flags = (scroll.flags & HSCROLLBAR_LEFT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0; GfxFillRectInset(dpi, { { l, t }, { l + (kScrollBarWidth - 1), b } }, colour, flags); - GfxDrawString(dpi, { l + 1, t }, static_cast(BlackLeftArrowString), {}); + DrawText(dpi, { l + 1, t }, {}, static_cast(BlackLeftArrowString)); } // Thumb @@ -762,7 +761,7 @@ static void WidgetHScrollbarDraw( uint8_t flags = (scroll.flags & HSCROLLBAR_RIGHT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0; GfxFillRectInset(dpi, { { r - (kScrollBarWidth - 1), t }, { r, b } }, colour, flags); - GfxDrawString(dpi, { r - 6, t }, static_cast(BlackRightArrowString), {}); + DrawText(dpi, { r - 6, t }, {}, static_cast(BlackRightArrowString)); } } @@ -782,7 +781,7 @@ static void WidgetVScrollbarDraw( GfxFillRectInset( dpi, { { l, t }, { r, t + (kScrollBarWidth - 1) } }, colour, ((scroll.flags & VSCROLLBAR_UP_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0)); - GfxDrawString(dpi, { l + 1, t - 1 }, static_cast(BlackUpArrowString), {}); + DrawText(dpi, { l + 1, t - 1 }, {}, static_cast(BlackUpArrowString)); // Thumb GfxFillRectInset( @@ -795,7 +794,7 @@ static void WidgetVScrollbarDraw( GfxFillRectInset( dpi, { { l, b - (kScrollBarWidth - 1) }, { r, b } }, colour, ((scroll.flags & VSCROLLBAR_DOWN_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0)); - GfxDrawString(dpi, { l + 1, b - (kScrollBarWidth - 1) }, static_cast(BlackDownArrowString), {}); + DrawText(dpi, { l + 1, b - (kScrollBarWidth - 1) }, {}, static_cast(BlackDownArrowString)); } /** diff --git a/src/openrct2-ui/scripting/ScGraphicsContext.hpp b/src/openrct2-ui/scripting/ScGraphicsContext.hpp index 9115d1033c..830780c41c 100644 --- a/src/openrct2-ui/scripting/ScGraphicsContext.hpp +++ b/src/openrct2-ui/scripting/ScGraphicsContext.hpp @@ -13,7 +13,6 @@ # include "CustomImages.h" -# include # include namespace OpenRCT2::Scripting @@ -235,7 +234,7 @@ namespace OpenRCT2::Scripting void text(const std::string& text, int32_t x, int32_t y) { - GfxDrawString(_dpi, { x, y }, text.c_str(), { _colour.value_or(0) }); + DrawText(_dpi, { x, y }, { _colour.value_or(0) }, text.c_str()); } }; } // namespace OpenRCT2::Scripting diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 2dc3ea20d6..76fc763ca9 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -202,7 +201,7 @@ static Widget _windowChangelogWidgets[] = { if (screenCoords.y + lineHeight < dpi.y || screenCoords.y >= dpi.y + dpi.height) continue; - GfxDrawString(dpi, screenCoords, line.c_str(), { colours[0] }); + DrawText(dpi, screenCoords, { colours[0] }, line.c_str()); } } diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index 9a9c96f818..c0821bfc03 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -211,8 +210,7 @@ static Widget window_custom_currency_widgets[] = { + ScreenCoordsXY{ window_custom_currency_widgets[WIDX_SYMBOL_TEXT].left + 1, window_custom_currency_widgets[WIDX_SYMBOL_TEXT].top }; - GfxDrawString( - dpi, screenCoords, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, { colours[1] }); + DrawText(dpi, screenCoords, { colours[1] }, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode); auto drawPos = windowPos + ScreenCoordsXY{ window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].left + 1, diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 3949839cca..460edfc4c0 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -754,9 +753,9 @@ static std::vector _window_editor_object_selection_widgets = { if (*listItem.flags & (ObjectSelectionFlags::InUse | ObjectSelectionFlags::AlwaysRequired)) colour2 |= COLOUR_FLAG_INSET; - GfxDrawString( - dpi, screenCoords, static_cast(CheckBoxMarkString), - { static_cast(colour2), FontStyle::Medium, darkness }); + DrawText( + dpi, screenCoords, { static_cast(colour2), FontStyle::Medium, darkness }, + static_cast(CheckBoxMarkString)); } screenCoords.x = gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 15; diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 4d59238c87..f99a555987 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -1170,9 +1169,9 @@ static uint64_t window_editor_objective_options_page_hold_down_widgets[] = { if (currentRide->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE) { auto darkness = stringId == STR_WINDOW_COLOUR_2_STRINGID ? TextDarkness::ExtraDark : TextDarkness::Dark; - GfxDrawString( - dpi, { 2, y }, static_cast(CheckBoxMarkString), - { static_cast(colours[1] & 0x7F), FontStyle::Medium, darkness }); + DrawText( + dpi, { 2, y }, { static_cast(colours[1] & 0x7F), FontStyle::Medium, darkness }, + static_cast(CheckBoxMarkString)); } // Ride name diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 7a840512ef..5e7f519637 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1865,7 +1865,7 @@ static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT); OpenRCT2::FormatStringLegacy(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SLOPE, ft2.Data()); SafeStrCat(buffer, buffer2, sizeof(buffer)); } - GfxDrawString(dpi, screenCoords, buffer, {}); + DrawText(dpi, screenCoords, {}, buffer); } screenCoords.y += kListRowHeight; { diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 759692f430..7e0fe94c5a 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -781,7 +780,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = { } screenCoords.x = 0; GfxClipString(_buffer.data(), 230, FontStyle::Medium); - GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); + DrawText(dpi, screenCoords, { colour }, _buffer.c_str()); // Draw group name _buffer.resize(0); @@ -792,7 +791,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = { screenCoords.x = 173; _buffer += NetworkGetGroupName(group); GfxClipString(_buffer.data(), 80, FontStyle::Medium); - GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); + DrawText(dpi, screenCoords, { colour }, _buffer.c_str()); } // Draw last action @@ -829,7 +828,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = { _buffer += pingBuffer; screenCoords.x = 356; - GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour }); + DrawText(dpi, screenCoords, { colour }, _buffer.c_str()); } screenCoords.y += kScrollableRowHeight; listPosition++; @@ -909,7 +908,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = { if (NetworkCanPerformAction(groupindex, static_cast(i))) { screenCoords.x = 0; - GfxDrawString(dpi, screenCoords, u8"{WINDOW_COLOUR_2}✓", {}); + DrawText(dpi, screenCoords, {}, u8"{WINDOW_COLOUR_2}✓"); } } diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index 248371af3c..cc8445c139 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -106,7 +105,7 @@ static Widget window_network_status_widgets[] = { GfxClipString(_buffer.data(), widgets[WIDX_BACKGROUND].right - 50, FontStyle::Medium); ScreenCoordsXY screenCoords(windowPos.x + (width / 2), windowPos.y + (height / 2)); screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::Medium) / 2; - GfxDrawString(dpi, screenCoords, _buffer.c_str()); + DrawText(dpi, screenCoords, { COLOUR_BLACK }, _buffer.c_str()); } void SetCloseCallBack(close_callback onClose) diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index 47fd301eb4..1016c1614a 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -538,7 +538,7 @@ static Widget window_object_load_error_widgets[] = { auto name = entry.GetName(); char buffer[256]; String::Set(buffer, sizeof(buffer), name.data(), name.size()); - GfxDrawString(dpi, screenCoords, buffer, { COLOUR_DARK_GREEN }); + DrawText(dpi, screenCoords, { COLOUR_DARK_GREEN }, buffer); if (entry.Generation == ObjectGeneration::DAT) { diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index eed24b5dca..0df447bcba 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -456,7 +455,7 @@ static Widget *window_player_page_widgets[] = { DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft); char ping[64]; snprintf(ping, 64, "%d ms", NetworkGetPlayerPing(player)); - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(30, 0), ping, { colours[2] }); + DrawText(dpi, screenCoords + ScreenCoordsXY(30, 0), { colours[2] }, ping); // Draw last action screenCoords = windowPos + ScreenCoordsXY{ width / 2, height - 13 }; diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 850c68bc27..8b2af0256f 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -16,7 +16,6 @@ # include # include # include -# include # include # include # include @@ -424,7 +423,7 @@ static Widget _serverListWidgets[] = { // Draw number of players screenCoords.x = right - numPlayersStringWidth; - GfxDrawString(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, players, { colours[1] }); + DrawText(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, { colours[1] }, players); screenCoords.y += ITEM_HEIGHT; } diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 944825bb4b..00fd5d301a 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -810,9 +809,10 @@ static WindowClass window_themes_tab_7_classes[] = { GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_E0); if (colour & COLOUR_FLAG_TRANSLUCENT) { - GfxDrawString( - dpi, topLeft, static_cast(CheckBoxMarkString), - { static_cast(colours[1] & 0x7F), FontStyle::Medium, TextDarkness::Dark }); + DrawText( + dpi, topLeft, + { static_cast(colours[1] & 0x7F), FontStyle::Medium, TextDarkness::Dark }, + static_cast(CheckBoxMarkString)); } } } diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 767cc7a6a0..72c7a5780b 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1031,8 +1031,8 @@ static uint64_t PageDisabledWidgets[] = { ScreenCoordsXY screenCoords(windowPos.x, windowPos.y); // Draw coordinates - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(5, 24), "X:", { colours[1] }); - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(74, 24), "Y:", { colours[1] }); + DrawText(dpi, screenCoords + ScreenCoordsXY(5, 24), { colours[1] }, "X:"); + DrawText(dpi, screenCoords + ScreenCoordsXY(74, 24), { colours[1] }, "Y:"); if (_tileSelected) { auto tileCoords = TileCoordsXY{ _toolMap }; @@ -1048,8 +1048,8 @@ static uint64_t PageDisabledWidgets[] = { } else { - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(43 - 7, 24), "-", { colours[1] }); - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(113 - 7, 24), "-", { colours[1] }); + DrawText(dpi, screenCoords + ScreenCoordsXY(43 - 7, 24), { colours[1] }, "-"); + DrawText(dpi, screenCoords + ScreenCoordsXY(113 - 7, 24), { colours[1] }, "-"); } if (windowTileInspectorSelectedIndex != -1) diff --git a/src/openrct2/drawing/Drawing.String.cpp b/src/openrct2/drawing/Drawing.String.cpp index 9d97a8fa9f..17bb5f9aaf 100644 --- a/src/openrct2/drawing/Drawing.String.cpp +++ b/src/openrct2/drawing/Drawing.String.cpp @@ -7,8 +7,6 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ -#include "../drawing/Drawing.h" - #include "../Context.h" #include "../common.h" #include "../config/Config.h" @@ -264,7 +262,7 @@ void GfxDrawStringLeftCentred(DrawPixelInfo& dpi, StringId format, void* args, c auto bufferPtr = buffer; FormatStringLegacy(bufferPtr, sizeof(buffer), format, args); int32_t height = StringGetHeightRaw(bufferPtr, FontStyle::Medium); - GfxDrawString(dpi, coords - ScreenCoordsXY{ 0, (height / 2) }, bufferPtr, { colour }); + DrawText(dpi, coords - ScreenCoordsXY{ 0, (height / 2) }, { colour }, bufferPtr); } /** @@ -326,13 +324,13 @@ void DrawStringCentredRaw( DrawPixelInfo& dpi, const ScreenCoordsXY& coords, int32_t numLines, const utf8* text, FontStyle fontStyle) { ScreenCoordsXY screenCoords(dpi.x, dpi.y); - GfxDrawString(dpi, screenCoords, "", { COLOUR_BLACK, fontStyle }); + DrawText(dpi, screenCoords, { COLOUR_BLACK, fontStyle }, ""); screenCoords = coords; for (int32_t i = 0; i <= numLines; i++) { int32_t width = GfxGetStringWidth(text, fontStyle); - GfxDrawString(dpi, screenCoords - ScreenCoordsXY{ width / 2, 0 }, text, { TEXT_COLOUR_254, fontStyle }); + DrawText(dpi, screenCoords - ScreenCoordsXY{ width / 2, 0 }, { TEXT_COLOUR_254, fontStyle }, text); const utf8* ch = text; const utf8* nextCh = nullptr; @@ -424,7 +422,7 @@ void DrawNewsTicker( int32_t numLines, lineHeight, lineY; ScreenCoordsXY screenCoords(dpi.x, dpi.y); - GfxDrawString(dpi, screenCoords, "", { colour }); + DrawText(dpi, screenCoords, { colour }, ""); u8string wrappedString; GfxWrapString(FormatStringID(format, args), width, FontStyle::Small, &wrappedString, &numLines); @@ -463,7 +461,7 @@ void DrawNewsTicker( } screenCoords = { coords.x - halfWidth, lineY }; - GfxDrawString(dpi, screenCoords, buffer, { TEXT_COLOUR_254, FontStyle::Small }); + DrawText(dpi, screenCoords, { TEXT_COLOUR_254, FontStyle::Small }, buffer); if (numCharactersDrawn > numCharactersToDraw) { diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 012ad0ac28..85c7f58640 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -577,8 +577,6 @@ void FASTCALL GfxDrawSpriteRawMaskedSoftware( DrawPixelInfo& dpi, const ScreenCoordsXY& scrCoords, const ImageId maskImage, const ImageId colourImage); // string -void GfxDrawString(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, const_utf8string buffer, TextPaint textPaint = {}); - void GfxDrawStringLeftCentred(DrawPixelInfo& dpi, StringId format, void* args, colour_t colour, const ScreenCoordsXY& coords); void DrawStringCentredRaw( DrawPixelInfo& dpi, const ScreenCoordsXY& coords, int32_t numLines, const utf8* text, FontStyle fontStyle); diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index e368a498b8..60abc85e12 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -140,11 +140,6 @@ void DrawTextEllipsised( DrawText(dpi, coords, textPaint, buffer); } -void GfxDrawString(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, const_utf8string buffer, TextPaint textPaint) -{ - DrawText(dpi, coords, textPaint, buffer); -} - int32_t DrawTextWrapped(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, int32_t width, StringId format) { Formatter ft{}; diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index 88ec236bc8..0a8de0675a 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -287,7 +287,7 @@ static int32_t ChatHistoryDrawString(DrawPixelInfo& dpi, const char* text, const int32_t lineY = screenCoords.y; for (int32_t line = 0; line <= numLines; ++line) { - GfxDrawString(dpi, { screenCoords.x, lineY - (numLines * lineHeight) }, bufferPtr, { TEXT_COLOUR_254 }); + DrawText(dpi, { screenCoords.x, lineY - (numLines * lineHeight) }, { TEXT_COLOUR_254 }, bufferPtr); bufferPtr = GetStringEnd(bufferPtr) + 1; lineY += lineHeight; } diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 89ac1a31d9..a081cd8018 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -14,7 +14,6 @@ #include "../OpenRCT2.h" #include "../ReplayManager.h" #include "../config/Config.h" -#include "../drawing/Drawing.h" #include "../drawing/IDrawingEngine.h" #include "../interface/Chat.h" #include "../interface/InteractiveConsole.h" @@ -97,7 +96,7 @@ void Painter::PaintReplayNotice(DrawPixelInfo& dpi, const char* text) screenCoords.x = screenCoords.x - stringWidth; if (((GetGameState().CurrentTicks >> 1) & 0xF) > 4) - GfxDrawString(dpi, screenCoords, buffer, { COLOUR_SATURATED_RED }); + DrawText(dpi, screenCoords, { COLOUR_SATURATED_RED }, buffer); // Make area dirty so the text doesn't get drawn over the last GfxSetDirtyBlocks({ screenCoords, screenCoords + ScreenCoordsXY{ stringWidth, 16 } }); @@ -129,7 +128,7 @@ void Painter::PaintFPS(DrawPixelInfo& dpi) // Draw Text int32_t stringWidth = GfxGetStringWidth(buffer, FontStyle::Medium); screenCoords.x = screenCoords.x - (stringWidth / 2); - GfxDrawString(dpi, screenCoords, buffer); + DrawText(dpi, screenCoords, { COLOUR_WHITE }, buffer); // Make area dirty so the text doesn't get drawn over the last GfxSetDirtyBlocks({ { screenCoords - ScreenCoordsXY{ 16, 4 } }, { dpi.lastStringPos.x + 16, 16 } }); diff --git a/src/openrct2/scenes/title/TitleScene.cpp b/src/openrct2/scenes/title/TitleScene.cpp index bc9e06b89a..45ff71d270 100644 --- a/src/openrct2/scenes/title/TitleScene.cpp +++ b/src/openrct2/scenes/title/TitleScene.cpp @@ -18,7 +18,6 @@ #include "../../audio/audio.h" #include "../../config/Config.h" #include "../../core/Console.hpp" -#include "../../drawing/Drawing.h" #include "../../interface/Screenshot.h" #include "../../interface/Viewport.h" #include "../../interface/Window.h" @@ -442,7 +441,7 @@ void DrawOpenRCT2(DrawPixelInfo& dpi, const ScreenCoordsXY& screenCoords) // Write name and version information buffer += gVersionInfoFull; - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(5, 5 - 13), buffer.c_str(), { COLOUR_BLACK }); + DrawText(dpi, screenCoords + ScreenCoordsXY(5, 5 - 13), { COLOUR_BLACK }, buffer.c_str()); int16_t width = static_cast(GfxGetStringWidth(buffer, FontStyle::Medium)); // Write platform information @@ -452,7 +451,7 @@ void DrawOpenRCT2(DrawPixelInfo& dpi, const ScreenCoordsXY& screenCoords) buffer.append(OPENRCT2_ARCHITECTURE); buffer.append(")"); - GfxDrawString(dpi, screenCoords + ScreenCoordsXY(5, 5), buffer.c_str(), { COLOUR_BLACK }); + DrawText(dpi, screenCoords + ScreenCoordsXY(5, 5), { COLOUR_BLACK }, buffer.c_str()); width = std::max(width, static_cast(GfxGetStringWidth(buffer, FontStyle::Medium))); // Invalidate screen area