Import Text.h where applicable.

This commit is contained in:
Harry-Hopkinson 2024-05-09 17:49:32 +00:00
parent c5687db2dd
commit 7ca957d822
7 changed files with 15 additions and 7 deletions

View File

@ -16,6 +16,7 @@
#include <openrct2/Version.h>
#include <openrct2/core/FileSystem.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/drawing/Text.h>
#include <openrct2/localisation/Formatting.h>
#include <openrct2/localisation/Localisation.h>
#include <openrct2/platform/Platform.h>

View File

@ -22,6 +22,7 @@
#include <openrct2/config/Config.h>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/drawing/Text.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/localisation/Localisation.h>
#include <openrct2/object/MusicObject.h>

View File

@ -15,6 +15,7 @@
#include <openrct2/core/Http.h>
#include <openrct2/core/Json.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/drawing/Text.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/localisation/Formatting.h>
#include <openrct2/localisation/Localisation.h>

View File

@ -16,6 +16,7 @@
# include <openrct2/Context.h>
# include <openrct2/config/Config.h>
# include <openrct2/core/Json.hpp>
# include <openrct2/drawing/Text.h>
# include <openrct2/interface/Colour.h>
# include <openrct2/localisation/Formatter.h>
# include <openrct2/localisation/Localisation.h>
@ -423,7 +424,7 @@ static Widget _serverListWidgets[] = {
// Draw number of players
screenCoords.x = right - numPlayersStringWidth;
DrawText(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, { colours[1] }, static_cast<const char*>(players));
DrawText(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, { colours[1] }, players);
screenCoords.y += ITEM_HEIGHT;
}

View File

@ -15,6 +15,7 @@
#include <openrct2/Context.h>
#include <openrct2/Game.h>
#include <openrct2/Input.h>
#include <openrct2/drawing/Text.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/localisation/Localisation.h>
#include <openrct2/platform/Platform.h>

View File

@ -7,6 +7,8 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "../drawing/Text.h"
#include "../Context.h"
#include "../common.h"
#include "../config/Config.h"
@ -262,7 +264,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);
DrawText(dpi, coords - ScreenCoordsXY{ 0, (height / 2) }, { colour }, static_cast<const char*>(bufferPtr));
DrawText(dpi, coords - ScreenCoordsXY{ 0, (height / 2) }, { colour }, bufferPtr);
}
/**
@ -324,14 +326,14 @@ void DrawStringCentredRaw(
DrawPixelInfo& dpi, const ScreenCoordsXY& coords, int32_t numLines, const utf8* text, FontStyle fontStyle)
{
ScreenCoordsXY screenCoords(dpi.x, dpi.y);
DrawText(dpi, screenCoords, { COLOUR_BLACK, fontStyle }, static_cast<const char*>(""));
DrawText(dpi, screenCoords, { COLOUR_BLACK, fontStyle }, "");
screenCoords = coords;
for (int32_t i = 0; i <= numLines; i++)
{
int32_t width = GfxGetStringWidth(text, fontStyle);
DrawText(
dpi, screenCoords - ScreenCoordsXY{ width / 2, 0 }, { TEXT_COLOUR_254, fontStyle }, static_cast<const char*>(text));
dpi, screenCoords - ScreenCoordsXY{ width / 2, 0 }, { TEXT_COLOUR_254, fontStyle }, text);
const utf8* ch = text;
const utf8* nextCh = nullptr;
@ -423,7 +425,7 @@ void DrawNewsTicker(
int32_t numLines, lineHeight, lineY;
ScreenCoordsXY screenCoords(dpi.x, dpi.y);
DrawText(dpi, screenCoords, { colour }, static_cast<const char*>(""));
DrawText(dpi, screenCoords, { colour }, "");
u8string wrappedString;
GfxWrapString(FormatStringID(format, args), width, FontStyle::Small, &wrappedString, &numLines);
@ -462,7 +464,7 @@ void DrawNewsTicker(
}
screenCoords = { coords.x - halfWidth, lineY };
DrawText(dpi, screenCoords, { TEXT_COLOUR_254, FontStyle::Small }, static_cast<const char*>(buffer));
DrawText(dpi, screenCoords, { TEXT_COLOUR_254, FontStyle::Small }, buffer);
if (numCharactersDrawn > numCharactersToDraw)
{

View File

@ -13,6 +13,7 @@
#include "../audio/AudioMixer.h"
#include "../audio/audio.h"
#include "../drawing/Drawing.h"
#include "../drawing/Text.h"
#include "../localisation/Formatter.h"
#include "../localisation/Formatting.h"
#include "../localisation/Localisation.h"
@ -288,7 +289,7 @@ static int32_t ChatHistoryDrawString(DrawPixelInfo& dpi, const char* text, const
for (int32_t line = 0; line <= numLines; ++line)
{
DrawText(
dpi, { screenCoords.x, lineY - (numLines * lineHeight) }, { TEXT_COLOUR_254 }, static_cast<const char*>(bufferPtr));
dpi, { screenCoords.x, lineY - (numLines * lineHeight) }, { TEXT_COLOUR_254 }, bufferPtr);
bufferPtr = GetStringEnd(bufferPtr) + 1;
lineY += lineHeight;
}