mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-27 00:34:46 +01:00
Replace #define with constexpr in Colour.h
Co-authored-by: Gymnasiast <Gymnasiast@users.noreply.github.com>
This commit is contained in:
@@ -333,7 +333,7 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
|
||||
|
||||
// Draw current line
|
||||
lineBuffer = _colourFormatStr + _consoleCurrentLine;
|
||||
DrawText(dpi, screenCoords, { TEXT_COLOUR_255, InGameConsoleGetFontStyle() }, lineBuffer.c_str(), true);
|
||||
DrawText(dpi, screenCoords, { kTextColour255, InGameConsoleGetFontStyle() }, lineBuffer.c_str(), true);
|
||||
|
||||
// Draw caret
|
||||
if (_consoleCaretTicks < CONSOLE_CARET_FLASH_THRESHOLD)
|
||||
|
||||
@@ -332,7 +332,7 @@ void DrawStringCentredRaw(
|
||||
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 }, text);
|
||||
DrawText(dpi, screenCoords - ScreenCoordsXY{ width / 2, 0 }, { kTextColour254, fontStyle }, text);
|
||||
|
||||
const utf8* ch = text;
|
||||
const utf8* nextCh = nullptr;
|
||||
@@ -463,7 +463,7 @@ void DrawNewsTicker(
|
||||
}
|
||||
|
||||
screenCoords = { coords.x - halfWidth, lineY };
|
||||
DrawText(dpi, screenCoords, { TEXT_COLOUR_254, FontStyle::Small }, buffer);
|
||||
DrawText(dpi, screenCoords, { kTextColour254, FontStyle::Small }, buffer);
|
||||
|
||||
if (numCharactersDrawn > numCharactersToDraw)
|
||||
{
|
||||
@@ -749,7 +749,7 @@ static void TTFProcessString(DrawPixelInfo& dpi, std::string_view text, TextDraw
|
||||
|
||||
static void TTFProcessInitialColour(ColourWithFlags colour, TextDrawInfo* info)
|
||||
{
|
||||
if (colour.colour != TEXT_COLOUR_254 && colour.colour != TEXT_COLOUR_255)
|
||||
if (colour.colour != kTextColour254 && colour.colour != kTextColour255)
|
||||
{
|
||||
info->flags &= ~(TEXT_DRAW_FLAG_INSET | TEXT_DRAW_FLAG_OUTLINE);
|
||||
if (colour.hasFlag(ColourFlag::withOutline))
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
for (int32_t line = 0; line < LineCount; ++line)
|
||||
{
|
||||
DrawText(dpi, lineCoords, tempPaint, buffer);
|
||||
tempPaint.Colour = TEXT_COLOUR_254;
|
||||
tempPaint.Colour = kTextColour254;
|
||||
buffer = GetStringEnd(buffer) + 1;
|
||||
lineCoords.y += LineHeight;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ void ChatDraw(DrawPixelInfo& dpi, ColourWithFlags chatBackgroundColor)
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(lineCh);
|
||||
inputLineHeight = DrawTextWrapped(
|
||||
dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, _chatWidth - 10, STR_STRING, ft, { TEXT_COLOUR_255 });
|
||||
dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, _chatWidth - 10, STR_STRING, ft, { kTextColour255 });
|
||||
GfxSetDirtyBlocks({ screenCoords, { screenCoords + ScreenCoordsXY{ _chatWidth, inputLineHeight + 15 } } });
|
||||
|
||||
// TODO: Show caret if the input text has multiple lines
|
||||
@@ -288,7 +288,7 @@ static int32_t ChatHistoryDrawString(DrawPixelInfo& dpi, const char* text, const
|
||||
int32_t lineY = screenCoords.y;
|
||||
for (int32_t line = 0; line <= numLines; ++line)
|
||||
{
|
||||
DrawText(dpi, { screenCoords.x, lineY - (numLines * lineHeight) }, { TEXT_COLOUR_254 }, bufferPtr);
|
||||
DrawText(dpi, { screenCoords.x, lineY - (numLines * lineHeight) }, { kTextColour254 }, bufferPtr);
|
||||
bufferPtr = GetStringEnd(bufferPtr) + 1;
|
||||
lineY += lineHeight;
|
||||
}
|
||||
|
||||
@@ -213,8 +213,8 @@ constexpr uint8_t kColourNumNormal = 54;
|
||||
|
||||
static constexpr uint8_t kLegacyColourFlagTranslucent = (1 << 7);
|
||||
|
||||
#define TEXT_COLOUR_254 (254)
|
||||
#define TEXT_COLOUR_255 (255)
|
||||
constexpr colour_t kTextColour254 = 254;
|
||||
constexpr colour_t kTextColour255 = 255;
|
||||
|
||||
enum class ColourFlag : uint8_t
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user