diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 7fd40749ab..d26f5b456c 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -29,6 +29,7 @@ #include #include #include + #include #include #include #include @@ -1210,7 +1211,7 @@ void OpenGLDrawingContext::DrawTTFBitmap( right += clip.GetLeft() - rt.x; bottom += clip.GetTop() - rt.y; - if (info->flags & TEXT_DRAW_FLAG_OUTLINE) + if (info->colourFlags.has(ColourFlag::withOutline)) { std::array boundsArr = { { { left + 1, top, right + 1, bottom }, @@ -1234,7 +1235,7 @@ void OpenGLDrawingContext::DrawTTFBitmap( command.zoom = 1.0f; } } - if (info->flags & TEXT_DRAW_FLAG_INSET) + if (info->colourFlags.has(ColourFlag::inset)) { DrawRectCommand& command = _commandBuffers.rects.allocate(); command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() }; diff --git a/src/openrct2-ui/interface/Dropdown.h b/src/openrct2-ui/interface/Dropdown.h index ca977cf1c3..ccb41849a7 100644 --- a/src/openrct2-ui/interface/Dropdown.h +++ b/src/openrct2-ui/interface/Dropdown.h @@ -20,8 +20,9 @@ struct ImageId; namespace OpenRCT2 { + struct ColourWithFlags; class Formatter; -} +} // namespace OpenRCT2 namespace OpenRCT2::Dropdown { diff --git a/src/openrct2-ui/interface/Graph.cpp b/src/openrct2-ui/interface/Graph.cpp index a56d97a2e3..6c737fb909 100644 --- a/src/openrct2-ui/interface/Graph.cpp +++ b/src/openrct2-ui/interface/Graph.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,7 @@ namespace OpenRCT2::Graph char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), fmt, curLabel); DrawText( - rt, { internalBounds.GetLeft() - kYTickMarkPadding, curScreenPos }, { FontStyle::Small, TextAlignment::RIGHT }, + rt, { internalBounds.GetLeft() - kYTickMarkPadding, curScreenPos }, { FontStyle::small, TextAlignment::right }, buffer); // Draw Y label tick mark Rectangle::fill( @@ -69,7 +70,7 @@ namespace OpenRCT2::Graph ft.Add(DateGameShortMonthNames[DateGetMonth((yearOver32 / 4) + MONTH_COUNT)]); DrawTextBasic( rt, screenCoords - ScreenCoordsXY{ 0, 14 }, STR_GRAPH_LABEL, ft, - { FontStyle::Small, TextAlignment::CENTRE }); + { FontStyle::small, TextAlignment::centre }); // Draw month tick mark Rectangle::fill( rt, { screenCoords - ScreenCoordsXY{ 0, 4 }, screenCoords - ScreenCoordsXY{ 0, 1 } }, PaletteIndex::pi10); @@ -100,7 +101,7 @@ namespace OpenRCT2::Graph kDashLength, PaletteIndex::pi10); GfxDrawDashedLine(rt, { { bounds.GetLeft(), coords.y }, coords }, kDashLength, PaletteIndex::pi10); - DrawText(rt, coords - ScreenCoordsXY{ 0, 16 }, { textCol, TextAlignment::CENTRE }, text); + DrawText(rt, coords - ScreenCoordsXY{ 0, 16 }, { textCol, TextAlignment::centre }, text); Rectangle::fill(rt, { { coords - ScreenCoordsXY{ 2, 2 } }, coords + ScreenCoordsXY{ 2, 2 } }, PaletteIndex::pi10); Rectangle::fill(rt, { { coords - ScreenCoordsXY{ 1, 1 } }, { coords + ScreenCoordsXY{ 1, 1 } } }, PaletteIndex::pi21); diff --git a/src/openrct2-ui/interface/Graph.h b/src/openrct2-ui/interface/Graph.h index 43914c8fff..9d0d637150 100644 --- a/src/openrct2-ui/interface/Graph.h +++ b/src/openrct2-ui/interface/Graph.h @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace OpenRCT2::Graph diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index ef5b1a7104..1c2c85685b 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,7 @@ static InGameConsole _inGameConsole; static FontStyle InGameConsoleGetFontStyle() { - return (Config::Get().interface.consoleSmallFont ? FontStyle::Small : FontStyle::Medium); + return (Config::Get().interface.consoleSmallFont ? FontStyle::small : FontStyle::medium); } static int32_t InGameConsoleGetLineHeight() @@ -298,7 +299,7 @@ void InGameConsole::Draw(RenderTarget& rt) const return; // Set font - ColourWithFlags textColour = { ThemeGetColour(WindowClass::console, 1).colour, 0 }; + ColourWithFlags textColour = { ThemeGetColour(WindowClass::console, 1).colour, {} }; const FontStyle style = InGameConsoleGetFontStyle(); const int32_t lineHeight = InGameConsoleGetLineHeight(); const int32_t maxLines = GetNumVisibleLines(); @@ -306,7 +307,7 @@ void InGameConsole::Draw(RenderTarget& rt) const // TTF looks far better without the outlines if (!LocalisationService_UseTrueTypeFont()) { - textColour.setFlag(ColourFlag::withOutline, true); + textColour.flags.set(ColourFlag::withOutline, true); } Invalidate(); diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index 3dbe710cf7..19e126415b 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -151,7 +152,7 @@ namespace OpenRCT2::Ui } static constexpr ColourWithFlags translucent(colour_t colour) { - return ColourWithFlags{ colour, EnumToFlag(ColourFlag::translucent) }; + return ColourWithFlags{ colour, { ColourFlag::translucent } }; } static constexpr WindowThemeDesc kWindowThemeDescriptors[] = @@ -322,7 +323,7 @@ namespace OpenRCT2::Ui for (uint8_t i = 0; i < wtDesc->windowColours.numColours; i++) { json_t jsonEntry = { { "colour", Colour::ToString(Theme.Colours[i].colour) }, - { "translucent", Theme.Colours[i].hasFlag(ColourFlag::translucent) } }; + { "translucent", Theme.Colours[i].flags.has(ColourFlag::translucent) } }; jsonColours.emplace_back(jsonEntry); } @@ -364,7 +365,8 @@ namespace OpenRCT2::Ui auto colourObject = Json::AsObject(jsonColours[i]); auto colour = Colour::FromString(Json::GetString(colourObject["colour"]), COLOUR_BLACK); auto isTranslucent = Json::GetBoolean(colourObject["translucent"], false); - uint8_t flags = isTranslucent ? EnumToFlag(ColourFlag::translucent) : 0; + ColourFlags flags{}; + flags.set(ColourFlag::translucent, isTranslucent); result.Theme.Colours[i] = { colour, flags }; } diff --git a/src/openrct2-ui/interface/Theme.h b/src/openrct2-ui/interface/Theme.h index daafcc6973..67840fd5a0 100644 --- a/src/openrct2-ui/interface/Theme.h +++ b/src/openrct2-ui/interface/Theme.h @@ -12,6 +12,11 @@ #include #include +namespace OpenRCT2 +{ + struct ColourWithFlags; +} + namespace OpenRCT2::Ui { enum diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 0c9c3476f4..71269ad154 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -357,9 +358,9 @@ namespace OpenRCT2::Ui return; auto colour = w.colours[widget.colour]; - colour.setFlag(ColourFlag::translucent, false); + colour.flags.set(ColourFlag::translucent, false); if (widgetIsDisabled(w, widgetIndex)) - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); // Resolve the absolute ltrb auto topLeft = w.windowPos + ScreenCoordsXY{ widget.left, 0 }; @@ -381,11 +382,11 @@ namespace OpenRCT2::Ui ScreenCoordsXY coords = { (topLeft.x + r + 1) / 2 - 1, topLeft.y }; if (widget.type == WidgetType::labelCentred) { - DrawTextWrapped(rt, coords, widget.width() - 2, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextWrapped(rt, coords, widget.width() - 2, stringId, ft, { colour, TextAlignment::centre }); } else { - DrawTextEllipsised(rt, coords, widget.width() - 2, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextEllipsised(rt, coords, widget.width() - 2, stringId, ft, { colour, TextAlignment::centre }); } } @@ -403,7 +404,7 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget.colour]; if (widgetIsDisabled(w, widgetIndex)) - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); // Resolve the absolute ltrb int32_t l = w.windowPos.x + widget.left; @@ -429,7 +430,7 @@ namespace OpenRCT2::Ui ScreenCoordsXY coords = { l + 1, t }; if (widget.type == WidgetType::labelCentred) { - DrawTextWrapped(rt, coords, r - l, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextWrapped(rt, coords, r - l, stringId, ft, { colour, TextAlignment::centre }); } else { @@ -492,7 +493,7 @@ namespace OpenRCT2::Ui { auto colour = w.colours[widget.colour].withFlag(ColourFlag::translucent, false); if (widgetIsDisabled(w, widgetIndex)) - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); utf8 buffer[512] = { 0 }; OpenRCT2::FormatStringLegacy(buffer, sizeof(buffer), stringId, rawFt.Data()); @@ -500,7 +501,7 @@ namespace OpenRCT2::Ui auto ft = Formatter(); ft.Add(buffer); DrawTextBasic(rt, { l, t }, STR_STRING, ft, { colour }); - textRight = l + GfxGetStringWidth(buffer, FontStyle::Medium) + 1; + textRight = l + GfxGetStringWidth(buffer, FontStyle::medium) + 1; } // Border @@ -589,7 +590,7 @@ namespace OpenRCT2::Ui DrawTextEllipsised( rt, topLeft, width, widget->text, Formatter::Common(), - { ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::CENTRE }); + { ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::centre }); } /** @@ -624,9 +625,9 @@ namespace OpenRCT2::Ui topLeft = w.windowPos + ScreenCoordsXY{ widget.midX() - 1, std::max(widget.top, widget.midY() - 5) }; if (widgetIsDisabled(w, widgetIndex)) - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); - DrawText(rt, topLeft, { colour, TextAlignment::CENTRE }, widget.string); + DrawText(rt, topLeft, { colour, TextAlignment::centre }, widget.string); } /** @@ -652,7 +653,7 @@ namespace OpenRCT2::Ui if (widgetIsDisabled(w, widgetIndex)) { - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); } // fill it when checkbox is pressed @@ -762,7 +763,7 @@ namespace OpenRCT2::Ui static void WidgetHScrollbarDraw( RenderTarget& rt, const ScrollArea& scroll, int32_t l, int32_t t, int32_t r, int32_t b, ColourWithFlags colour) { - colour.setFlag(ColourFlag::translucent, false); + colour.flags.set(ColourFlag::translucent, false); // Trough Rectangle::fill(rt, { { l + kScrollBarWidth, t }, { r - kScrollBarWidth, b } }, ColourMapA[colour.colour].lighter); @@ -809,7 +810,7 @@ namespace OpenRCT2::Ui static void WidgetVScrollbarDraw( RenderTarget& rt, const ScrollArea& scroll, int32_t l, int32_t t, int32_t r, int32_t b, ColourWithFlags colour) { - colour.setFlag(ColourFlag::translucent, false); + colour.flags.set(ColourFlag::translucent, false); // Trough Rectangle::fill(rt, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, ColourMapA[colour.colour].lighter); @@ -1173,7 +1174,7 @@ namespace OpenRCT2::Ui if (widget.text != 0) { u8string wrappedString; - GfxWrapString(widget.string, bottomRight.x - topLeft.x - 5, FontStyle::Medium, &wrappedString, nullptr); + GfxWrapString(widget.string, bottomRight.x - topLeft.x - 5, FontStyle::medium, &wrappedString, nullptr); DrawText(rt, { topLeft.x + 2, topLeft.y }, { w.colours[1] }, wrappedString.c_str(), true); } return; @@ -1182,7 +1183,7 @@ namespace OpenRCT2::Ui // String length needs to add 12 either side of box // +13 for cursor when max length. u8string wrappedString; - GfxWrapString(*textInput->Buffer, bottomRight.x - topLeft.x - 5 - 6, FontStyle::Medium, &wrappedString, nullptr); + GfxWrapString(*textInput->Buffer, bottomRight.x - topLeft.x - 5 - 6, FontStyle::medium, &wrappedString, nullptr); DrawText(rt, { topLeft.x + 2, topLeft.y }, { w.colours[1] }, wrappedString.c_str(), true); @@ -1190,7 +1191,7 @@ namespace OpenRCT2::Ui int32_t curX = topLeft.x + GfxGetStringWidthNoFormatting( u8string_view{ wrappedString.c_str(), std::min(wrappedString.length(), textInput->SelectionStart) }, - FontStyle::Medium) + FontStyle::medium) + 3; int32_t width = 6; @@ -1199,7 +1200,7 @@ namespace OpenRCT2::Ui // Make a new 1 character wide string for measuring the width // of the character that the cursor is under. (NOTE: this is broken for multi byte utf8 codepoints) width = std::max( - GfxGetStringWidthNoFormatting(u8string{ (*textInput->Buffer)[textInput->SelectionStart] }, FontStyle::Medium) + GfxGetStringWidthNoFormatting(u8string{ (*textInput->Buffer)[textInput->SelectionStart] }, FontStyle::medium) - 2, 4); } diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 7dc92a811a..add4be58e9 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -696,13 +696,13 @@ void CustomListView::PaintHeading( { auto ft = Formatter(); ft.Add(STR_UP); - DrawTextBasic(rt, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT }); + DrawTextBasic(rt, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::right }); } else if (sortOrder == ColumnSortOrder::Descending) { auto ft = Formatter(); ft.Add(STR_DOWN); - DrawTextBasic(rt, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT }); + DrawTextBasic(rt, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::right }); } } @@ -724,12 +724,12 @@ void CustomListView::PaintSeparator(RenderTarget& rt, const ScreenCoordsXY& pos, // Draw string Formatter ft; ft.Add(text); - DrawTextBasic(rt, { centreX, pos.y }, STR_STRING, ft, { baseColour, TextAlignment::CENTRE }); + DrawTextBasic(rt, { centreX, pos.y }, STR_STRING, ft, { baseColour, TextAlignment::centre }); // Get string dimensions utf8 stringBuffer[512]{}; FormatStringLegacy(stringBuffer, sizeof(stringBuffer), STR_STRING, ft.Data()); - int32_t categoryStringHalfWidth = (GfxGetStringWidth(stringBuffer, FontStyle::Medium) / 2) + 4; + int32_t categoryStringHalfWidth = (GfxGetStringWidth(stringBuffer, FontStyle::medium) / 2) + 4; int32_t strLeft = centreX - categoryStringHalfWidth; int32_t strRight = centreX + categoryStringHalfWidth; diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 6e786ef75e..982e913e5b 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -23,6 +23,7 @@ #include #include #include + #include #include #include #include @@ -157,7 +158,7 @@ namespace OpenRCT2::Ui::Windows result.Text = ProcessString(desc["text"]); if (ProcessString(desc["textAlign"]) == "centred") { - result.TextAlign = TextAlignment::CENTRE; + result.TextAlign = TextAlignment::centre; } } else if (result.Type == "listview") @@ -318,9 +319,9 @@ namespace OpenRCT2::Ui::Windows if (w.type() == DukValue::Type::NUMBER) { colour_t colour = w.as_uint() & ~kLegacyColourFlagTranslucent; - auto isTranslucent = (w.as_uint() & kLegacyColourFlagTranslucent); + bool isTranslucent = (w.as_uint() & kLegacyColourFlagTranslucent); c.colour = std::clamp(colour, COLOUR_BLACK, COLOUR_COUNT - 1); - c.flags = (isTranslucent ? EnumToFlag(ColourFlag::translucent) : 0); + c.flags.set(ColourFlag::translucent, isTranslucent); } return c; }); @@ -488,7 +489,7 @@ namespace OpenRCT2::Ui::Windows void onPrepareDraw() override { auto& closeButton = widgets[WIDX_CLOSE]; - bool translucent = colours[closeButton.colour].hasFlag(ColourFlag::translucent); + bool translucent = colours[closeButton.colour].flags.has(ColourFlag::translucent); if (Config::Get().interface.enlargedUi) closeButton.string = !translucent ? kCloseBoxStringBlackLarge : kCloseBoxStringWhiteLarge; else @@ -1053,7 +1054,7 @@ namespace OpenRCT2::Ui::Windows widget.type = WidgetType::label; widget.string = const_cast(desc.Text.c_str()); widget.flags.set(WidgetFlag::textIsString); - if (desc.TextAlign == TextAlignment::CENTRE) + if (desc.TextAlign == TextAlignment::centre) { widget.type = WidgetType::labelCentred; } diff --git a/src/openrct2-ui/scripting/ScGraphicsContext.hpp b/src/openrct2-ui/scripting/ScGraphicsContext.hpp index 02db09929d..b40278c2ae 100644 --- a/src/openrct2-ui/scripting/ScGraphicsContext.hpp +++ b/src/openrct2-ui/scripting/ScGraphicsContext.hpp @@ -159,8 +159,8 @@ namespace OpenRCT2::Scripting DukValue measureText(const std::string& text) { - auto width = GfxGetStringWidth(text, FontStyle::Medium); - auto height = StringGetHeightRaw(text.c_str(), FontStyle::Medium); + auto width = GfxGetStringWidth(text, FontStyle::medium); + auto height = StringGetHeightRaw(text.c_str(), FontStyle::medium); return ToDuk(_ctx, { width, height }); } diff --git a/src/openrct2-ui/scripting/ScWindow.hpp b/src/openrct2-ui/scripting/ScWindow.hpp index 93abaafb9e..32d7e67dc0 100644 --- a/src/openrct2-ui/scripting/ScWindow.hpp +++ b/src/openrct2-ui/scripting/ScWindow.hpp @@ -13,6 +13,7 @@ #include "ScWidget.hpp" + #include #include #include #include @@ -238,7 +239,7 @@ namespace OpenRCT2::Scripting for (auto c : w->colours) { auto colour = c.colour; - if (c.hasFlag(ColourFlag::translucent)) + if (c.flags.has(ColourFlag::translucent)) colour |= kLegacyColourFlagTranslucent; result.push_back(colour); } @@ -256,9 +257,9 @@ namespace OpenRCT2::Scripting if (i < colours.size()) { colour_t colour = colours[i] & ~kLegacyColourFlagTranslucent; - auto isTranslucent = (colours[i] & kLegacyColourFlagTranslucent); + bool isTranslucent = (colours[i] & kLegacyColourFlagTranslucent); c.colour = std::clamp(colour, COLOUR_BLACK, COLOUR_COUNT - 1); - c.flags = (isTranslucent ? EnumToFlag(ColourFlag::translucent) : 0); + c.flags.set(ColourFlag::translucent, isTranslucent); } w->colours[i] = c; } diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 09f3cce5ad..dffaab089a 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -165,14 +165,14 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_TITLE_SEQUENCE_OPENRCT2); DrawTextWrapped( rt, aboutOpenRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, - { COLOUR_AQUAMARINE, TextAlignment::CENTRE }); + { COLOUR_AQUAMARINE, TextAlignment::centre }); } { // TODO: this string shouldn't be reused for this tab auto ft = Formatter(); ft.Add(STR_TITLE_SEQUENCE_RCT2); DrawTextWrapped( - rt, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::CENTRE }); + rt, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::centre }); } int32_t newHeight = 0; @@ -232,9 +232,9 @@ namespace OpenRCT2::Ui::Windows const auto& versionWidget = widgets[WIDX_VERSION]; auto centreX = versionWidget.midX(); - auto centreY = versionWidget.midY() - FontGetLineHeight(FontStyle::Medium) / 2; + auto centreY = versionWidget.midY() - FontGetLineHeight(FontStyle::medium) / 2; auto centrePos = windowPos + ScreenCoordsXY(centreX, centreY); - DrawTextWrapped(rt, centrePos, versionWidget.width(), STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); + DrawTextWrapped(rt, centrePos, versionWidget.width(), STR_STRING, ft, { colours[1], TextAlignment::centre }); // Shows the update available button if (OpenRCT2::GetContext()->HasNewVersionInfo()) @@ -243,7 +243,7 @@ namespace OpenRCT2::Ui::Windows } // Draw the rest of the text - TextPaint tp{ colours[1], TextAlignment::CENTRE }; + TextPaint tp{ colours[1], TextAlignment::centre }; auto textCoords = windowPos + ScreenCoordsXY((width / 2) - 1, 240); auto textWidth = kWindowSize.width - (kPadding * 2); for (auto stringId : _OpenRCT2InfoStrings) @@ -257,7 +257,7 @@ namespace OpenRCT2::Ui::Windows auto& backgroundWidget = widgets[WIDX_PAGE_BACKGROUND]; auto textCoords = windowPos + ScreenCoordsXY{ backgroundWidget.midX(), backgroundWidget.top + kPadding }; auto textWidth = kWindowSize.width - 20; - TextPaint tp{ colours[1], TextAlignment::CENTRE }; + TextPaint tp{ colours[1], TextAlignment::centre }; // Draw credits for (auto stringId : _RCT2InfoStrings) diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 6e2aa2d371..b573cb6f63 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -177,7 +177,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { - const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + const int32_t lineHeight = FontGetLineHeight(FontStyle::medium); ScreenCoordsXY screenCoords(3, 3 - lineHeight); for (const auto& line : _changelogLines) @@ -194,7 +194,7 @@ namespace OpenRCT2::Ui::Windows { return ScreenSize( _changelogLongestLineWidth + 4, - static_cast(_changelogLines.size()) * FontGetLineHeight(FontStyle::Medium)); + static_cast(_changelogLines.size()) * FontGetLineHeight(FontStyle::medium)); } private: @@ -271,7 +271,7 @@ namespace OpenRCT2::Ui::Windows _changelogLongestLineWidth = 0; for (const auto& line : _changelogLines) { - int32_t linewidth = GfxGetStringWidth(line.c_str(), FontStyle::Medium); + int32_t linewidth = GfxGetStringWidth(line.c_str(), FontStyle::medium); _changelogLongestLineWidth = std::max(linewidth, _changelogLongestLineWidth); } } diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index f016f3e523..73d18712f3 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -608,7 +608,7 @@ static StringId window_cheats_page_titles[] = { ft.Add(_moneySpinnerValue); if (isWidgetDisabled(WIDX_MONEY_SPINNER)) { - colour.setFlag(ColourFlag::inset, true); + colour.flags.set(ColourFlag::inset, true); } auto& widget = widgets[WIDX_MONEY_SPINNER]; @@ -630,20 +630,20 @@ static StringId window_cheats_page_titles[] = { ft.Add(_yearSpinnerValue); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ _xRcol, yearBox.top + 2 }, STR_FORMAT_INTEGER, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); ft = Formatter(); int32_t actual_month = _monthSpinnerValue - 1; ft.Add(actual_month); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ _xRcol, monthBox.top + 2 }, STR_FORMAT_MONTH, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); ft = Formatter(); ft.Add(_daySpinnerValue); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ _xRcol, dayBox.top + 2 }, STR_FORMAT_INTEGER, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); } else if (page == WINDOW_CHEATS_PAGE_PARK) { diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 5286ee8aa8..6cddde3b3f 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gLandToolSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } // Draw cost amount @@ -194,7 +194,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_clearSceneryCost); screenCoords.x = widgets[WIDX_PREVIEW].midX() + windowPos.x; screenCoords.y = widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 + 27; - DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::centre }); } } diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index 74f8370998..c15f9caae3 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -124,7 +125,7 @@ namespace OpenRCT2::Ui::Windows const auto& stringIdx = widgets[widgetIndex].text; auto string = ls.GetString(stringIdx); Guard::ArgumentNotNull(string); - const auto strWidth = GfxGetStringWidth(string, FontStyle::Medium); + const auto strWidth = GfxGetStringWidth(string, FontStyle::medium); newWidth = std::max(strWidth, newWidth); } diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index dc4219a39f..8d8bfafcef 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -87,7 +87,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_demolishRideCost); ScreenCoordsXY stringCoords(windowPos.x + kWindowSize.width / 2, windowPos.y + (kWindowSize.height / 2) - 3); - DrawTextWrapped(rt, stringCoords, kWindowSize.width - 4, stringId, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, kWindowSize.width - 4, stringId, ft, { TextAlignment::centre }); } } }; diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 0e5f4f8c64..2227a1d818 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -94,7 +95,7 @@ namespace OpenRCT2::Ui::Windows if (highlighted) colour.colour = COLOUR_WHITE; if (item.isDisabled()) - colour = { background, EnumToFlag(ColourFlag::inset) }; + colour = { background, { ColourFlag::inset } }; auto yOffset = GetAdditionalRowPadding(); Formatter ft; @@ -125,7 +126,7 @@ namespace OpenRCT2::Ui::Windows const auto rightBottom = leftTop + ScreenCoordsXY{ ItemWidth - 4, 0 }; const auto shadowOffset = ScreenCoordsXY{ 0, 1 }; - if (colours[0].hasFlag(ColourFlag::translucent)) + if (colours[0].flags.has(ColourFlag::translucent)) { TranslucentWindowPalette palette = kTranslucentWindowPalettes[colours[0].colour]; Rectangle::filter(rt, { leftTop, rightBottom }, palette.highlight); @@ -231,7 +232,7 @@ namespace OpenRCT2::Ui::Windows UpdateSizeAndPosition(screenPos, extraY); - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) flags |= WindowFlag::transparent; colours[0] = colour; } @@ -264,7 +265,7 @@ namespace OpenRCT2::Ui::Windows UpdateSizeAndPosition(screenPos, extraY); - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) flags |= WindowFlag::transparent; colours[0] = colour; } @@ -354,7 +355,7 @@ namespace OpenRCT2::Ui::Windows int32_t maxStringWidth = 0; for (size_t i = 0; i < num_items; i++) { - int32_t stringWidth = GfxGetStringWidth(gDropdown.items[i].text, FontStyle::Medium); + int32_t stringWidth = GfxGetStringWidth(gDropdown.items[i].text, FontStyle::medium); if (gDropdown.items[i].type != Dropdown::ItemType::plain) stringWidth += kDropdownItemLeftPadding; maxStringWidth = std::max(stringWidth, maxStringWidth); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index e180bca9c2..5f281d28e2 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -370,8 +370,8 @@ namespace OpenRCT2::Ui::Windows if (gLegacyScene == LegacyScene::trackDesigner) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; - DrawTextBasic(rt, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::CENTRE }); - DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); + DrawTextBasic(rt, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::centre }); + DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre }); } void DrawRightButtonBack(RenderTarget& rt) @@ -411,8 +411,8 @@ namespace OpenRCT2::Ui::Windows if (gLegacyScene == LegacyScene::trackDesigner) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; - DrawTextBasic(rt, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::CENTRE }); - DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE }); + DrawTextBasic(rt, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::centre }); + DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre }); } void DrawStepText(RenderTarget& rt) @@ -422,7 +422,7 @@ namespace OpenRCT2::Ui::Windows auto colour = colours[2].withFlag(ColourFlag::translucent, false).withFlag(ColourFlag::withOutline, true); DrawTextBasic( rt, { stateX, stateY }, kEditorStepNames[EnumValue(getGameState().editorStep)], {}, - { colour, TextAlignment::CENTRE }); + { colour, TextAlignment::centre }); } static constexpr FuncPtr kPreviousButtonMouseUp[] = { diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 72c7747b02..a9cacc26a2 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -312,15 +313,15 @@ namespace OpenRCT2::Ui::Windows // TODO: this parameter by itself produces very light text. // It needs a {BLACK} token in the string to work properly. ColourWithFlags colour = { COLOUR_BLACK }; - FontStyle fontStyle = FontStyle::Medium; - auto darkness = TextDarkness::Regular; + FontStyle fontStyle = FontStyle::medium; + auto darkness = TextDarkness::regular; if (researchItem.IsAlwaysResearched()) { if (_selectedResearchItem == &researchItem && dragItem == nullptr) - darkness = TextDarkness::ExtraDark; + darkness = TextDarkness::extraDark; else - darkness = TextDarkness::Dark; + darkness = TextDarkness::dark; colour = colours[1].withFlag(ColourFlag::inset, true); } @@ -431,7 +432,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(stringId); } - DrawTextEllipsised(rt, screenPos, itemWidth, drawString, ft, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenPos, itemWidth, drawString, ft, { TextAlignment::centre }); screenPos.y += 15; // Item category diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index a44b487dd8..c35b391bb7 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -761,12 +761,12 @@ namespace OpenRCT2::Ui::Windows && (*listItem.flags & ObjectSelectionFlags::Selected)) { screenCoords.x = 2; - auto darkness = highlighted ? TextDarkness::ExtraDark : TextDarkness::Dark; + auto darkness = highlighted ? TextDarkness::extraDark : TextDarkness::dark; auto colour2 = colours[1].withFlag(ColourFlag::translucent, false); if (*listItem.flags & (ObjectSelectionFlags::InUse | ObjectSelectionFlags::AlwaysRequired)) - colour2.setFlag(ColourFlag::inset, true); + colour2.flags.set(ColourFlag::inset, true); - DrawText(rt, screenCoords, { colour2, FontStyle::Medium, darkness }, kCheckMarkString); + DrawText(rt, screenCoords, { colour2, FontStyle::medium, darkness }, kCheckMarkString); } screenCoords.x = gLegacyScene == LegacyScene::trackDesignsManager ? 0 : 15; @@ -776,11 +776,11 @@ namespace OpenRCT2::Ui::Windows auto buffer = strchr(bufferWithColour, '\0'); colour_t colour = COLOUR_BLACK; - auto darkness = TextDarkness::Regular; + auto darkness = TextDarkness::regular; if (*listItem.flags & ObjectSelectionFlags::Flag6) { colour = colours[1].colour; - darkness = TextDarkness::Dark; + darkness = TextDarkness::dark; } int32_t width_limit = widgets[WIDX_LIST].width() - screenCoords.x; @@ -794,7 +794,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(itemBuffer); DrawTextEllipsised( - rt, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::Medium, darkness }); + rt, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::medium, darkness }); screenCoords.x = widgets[WIDX_LIST_SORT_RIDE].left - widgets[WIDX_LIST].left; } @@ -809,7 +809,7 @@ namespace OpenRCT2::Ui::Windows } auto ft = Formatter(); ft.Add(itemBuffer); - DrawTextEllipsised(rt, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness }); + DrawTextEllipsised(rt, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::medium, darkness }); } screenCoords.y += kScrollableRowHeight; } @@ -1261,7 +1261,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_STRING); ft.Add(listItem->repositoryItem->Name.c_str()); screenPos.y += DrawTextWrapped( - rt, screenPos, descriptionWidth, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); + rt, screenPos, descriptionWidth, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::centre }); // Leave some space between name and description screenPos.y += kListRowHeight; @@ -1364,7 +1364,7 @@ namespace OpenRCT2::Ui::Windows // Draw fallback image warning if (_loadedObject && _loadedObject->UsesFallbackImages()) { - DrawTextBasic(rt, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { COLOUR_WHITE, TextAlignment::right }); } screenPos.y += kListRowHeight; @@ -1372,7 +1372,7 @@ namespace OpenRCT2::Ui::Windows if (GetSelectedObjectType() == ObjectType::ride) { auto stringId = GetRideTypeStringId(listItem->repositoryItem); - DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right }); } // Draw peep animation object type @@ -1380,14 +1380,14 @@ namespace OpenRCT2::Ui::Windows { auto* animObj = reinterpret_cast(_loadedObject.get()); auto stringId = GetAnimationPeepTypeStringId(animObj->GetPeepType()); - DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right }); } screenPos.y += kListRowHeight; // Draw object source auto stringId = ObjectManagerGetSourceGameString(listItem->repositoryItem->GetFirstSourceGame()); - DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::right }); screenPos.y += kListRowHeight; // Draw object filename @@ -1398,7 +1398,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(path.c_str()); DrawTextBasic( rt, { windowPos.x + this->width - 5, screenPos.y }, STR_WINDOW_COLOUR_2_STRINGID, ft, - { COLOUR_BLACK, TextAlignment::RIGHT }); + { COLOUR_BLACK, TextAlignment::right }); screenPos.y += kListRowHeight; } @@ -1418,7 +1418,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(authorsString.c_str()); DrawTextEllipsised( rt, { windowPos.x + width - 5, screenPos.y }, width - widgets[WIDX_LIST].right - 4, - STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::RIGHT }); + STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::right }); } } diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 3b9bcc7d5f..44756ff062 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -2368,9 +2368,9 @@ namespace OpenRCT2::Ui::Windows { if (currentRide->lifecycleFlags & RIDE_LIFECYCLE_INDESTRUCTIBLE) { - auto darkness = stringId == STR_WINDOW_COLOUR_2_STRINGID ? TextDarkness::ExtraDark : TextDarkness::Dark; + auto darkness = stringId == STR_WINDOW_COLOUR_2_STRINGID ? TextDarkness::extraDark : TextDarkness::dark; DrawText( - rt, { 2, y }, { colours[1].withFlag(ColourFlag::translucent, false), FontStyle::Medium, darkness }, + rt, { 2, y }, { colours[1].withFlag(ColourFlag::translucent, false), FontStyle::medium, darkness }, kCheckMarkString); } diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index 2974fc11c7..dc9762175f 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -72,7 +72,7 @@ namespace OpenRCT2::Ui::Windows WindowDrawWidgets(*this, rt); auto screenCoords = windowPos + ScreenCoordsXY{ (width + 1) / 2 - 1, kPadding - 1 }; - DrawStringCentredRaw(rt, screenCoords, _numLines, _text.data(), FontStyle::Medium); + DrawStringCentredRaw(rt, screenCoords, _numLines, _text.data(), FontStyle::medium); } void onPeriodicUpdate() override @@ -126,13 +126,13 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseByClass(WindowClass::error); // How wide is the error string? - int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::Medium); + int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::medium); width = std::clamp(width + 2 * kPadding, kMinWidth, kMaxWidth); // How high is the error string? int32_t numLines{}; - GfxWrapString(buffer, width + 1, FontStyle::Medium, &buffer, &numLines); - int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::Medium) + (2 * kPadding); + GfxWrapString(buffer, width + 1, FontStyle::medium, &buffer, &numLines); + int32_t height = (numLines + 1) * FontGetLineHeight(FontStyle::medium) + (2 * kPadding); // Position error message around the cursor const CursorState* state = ContextGetCursorState(); diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index a3de9740f4..f704580167 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -435,7 +435,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, monthyear == currentMonthYear ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING, ft, - { TextUnderline::On, TextAlignment::RIGHT }); + { TextUnderline::on, TextAlignment::right }); screenCoords.y += 14; // Month expenditures @@ -452,7 +452,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(expenditure); DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, - { TextAlignment::RIGHT }); + { TextAlignment::right }); } screenCoords.y += kTableCellHeight; } @@ -463,7 +463,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(profit); DrawTextBasic( - rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, { TextAlignment::RIGHT }); + rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, { TextAlignment::right }); Rectangle::fill( rt, @@ -597,7 +597,7 @@ namespace OpenRCT2::Ui::Windows // Expenditure / Income heading DrawTextBasic( rt, screenCoords, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, {}, - { COLOUR_BLACK, TextUnderline::On, TextAlignment::LEFT }); + { COLOUR_BLACK, TextUnderline::on, TextAlignment::left }); screenCoords.y += 14; // Expenditure / Income row labels @@ -831,7 +831,7 @@ namespace OpenRCT2::Ui::Windows // dynamic padding for long axis labels: char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{CURRENCY2DP}", centredGraph ? -max : max); - int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1; + int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1; const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y }; _graphBounds = { windowPos + ScreenCoordsXY{ graphPageWidget->left + 4, graphPageWidget->top + 15 }, diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 32fed7dc57..4e67f824c1 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -593,7 +593,7 @@ namespace OpenRCT2::Ui::Windows // Draw build this... label screenCoords = this->windowPos + ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 23 }; - DrawTextBasic(rt, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::centre }); } // Draw cost @@ -605,7 +605,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_windowFootpathCost); - DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::centre }); } } } diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index ca82b080a7..e102ce55d1 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -100,7 +101,7 @@ namespace OpenRCT2::Ui::Windows Rectangle::FillMode::none); // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::medium); auto& gameState = getGameState(); @@ -115,7 +116,7 @@ namespace OpenRCT2::Ui::Windows StringId stringId = gameState.park.cash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH; auto ft = Formatter(); ft.Add(gameState.park.cash); - DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::centre }); } static constexpr StringId _guestCountFormats[] = { @@ -141,7 +142,7 @@ namespace OpenRCT2::Ui::Windows auto colour = GetHoverWidgetColour(WIDX_GUESTS); auto ft = Formatter(); ft.Add(gameState.park.numGuestsInPark); - DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::centre }); } // Draw park rating @@ -200,10 +201,10 @@ namespace OpenRCT2::Ui::Windows ft.Add(DateDayNames[day]); ft.Add(month); ft.Add(year); - DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, stringId, ft, { colour, TextAlignment::centre }); // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::medium); // Temperature screenCoords = { windowPos.x + rightPanelWidget.left + 15, static_cast(screenCoords.y + line_height + 1) }; @@ -363,7 +364,7 @@ namespace OpenRCT2::Ui::Windows colours[0], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::light, Rectangle::FillMode::none); // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::medium); ScreenCoordsXY middleWidgetCoords( windowPos.x + middleOutsetWidget->midX(), windowPos.y + middleOutsetWidget->top + line_height + 1); @@ -377,12 +378,12 @@ namespace OpenRCT2::Ui::Windows { // TODO: this string probably shouldn't be reused for this DrawTextWrapped( - rt, middleWidgetCoords, panelWidth, STR_TITLE_SEQUENCE_OPENRCT2, ft, { colours[0], TextAlignment::CENTRE }); + rt, middleWidgetCoords, panelWidth, STR_TITLE_SEQUENCE_OPENRCT2, ft, { colours[0], TextAlignment::centre }); } else { // Show tooltip in bottom toolbar - DrawTextWrapped(rt, middleWidgetCoords, panelWidth, STR_STRINGID, ft, { colours[0], TextAlignment::CENTRE }); + DrawTextWrapped(rt, middleWidgetCoords, panelWidth, STR_STRINGID, ft, { colours[0], TextAlignment::centre }); } } @@ -508,7 +509,7 @@ namespace OpenRCT2::Ui::Windows void onPrepareDraw() override { // Figure out how much line height we have to work with. - uint32_t line_height = FontGetLineHeight(FontStyle::Medium); + uint32_t line_height = FontGetLineHeight(FontStyle::medium); // Reset dimensions as appropriate -- in case we're switching languages. height = line_height * 2 + 12; @@ -695,7 +696,7 @@ namespace OpenRCT2::Ui::Windows int32_t screenHeight = ContextGetHeight(); // Figure out how much line height we have to work with. - uint32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + uint32_t lineHeight = FontGetLineHeight(FontStyle::medium); int32_t toolbarHeight = lineHeight * 2 + 12; auto* windowMgr = GetWindowManager(); diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index fb8dc2fda4..5d2bafee42 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -815,7 +815,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); peep->FormatActionTo(ft); int32_t textWidth = actionLabelWidget.width(); - DrawTextEllipsised(rt, screenPos, textWidth, STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenPos, textWidth, STR_BLACK_STRING, ft, { TextAlignment::centre }); } // Draw the marquee thought @@ -853,7 +853,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); PeepThoughtSetFormatArgs(&peep->Thoughts[i], ft); - DrawTextBasic(rtMarquee, { screenPos.x, 0 }, STR_WINDOW_COLOUR_2_STRINGID, ft, { FontStyle::Small }); + DrawTextBasic(rtMarquee, { screenPos.x, 0 }, STR_WINDOW_COLOUR_2_STRINGID, ft, { FontStyle::small }); } } @@ -1588,7 +1588,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); PeepThoughtSetFormatArgs(&thought, ft); - screenCoords.y += DrawTextWrapped(rt, screenCoords, widgWidth, STR_BLACK_STRING, ft, { FontStyle::Small }); + screenCoords.y += DrawTextWrapped(rt, screenCoords, widgWidth, STR_BLACK_STRING, ft, { FontStyle::small }); // If this is the last visible line end drawing. if (screenCoords.y > windowPos.y + widgets[WIDX_PAGE_BACKGROUND].bottom - 32) diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 4b31c17cba..2ffd91b894 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -699,7 +699,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); PeepThoughtSetFormatArgs(&thought, ft); - DrawTextEllipsised(rt, { 118, y }, 329, format, ft, { FontStyle::Small }); + DrawTextEllipsised(rt, { 118, y }, 329, format, ft, { FontStyle::small }); break; } break; @@ -744,7 +744,7 @@ namespace OpenRCT2::Ui::Windows // Draw small font if displaying guests if (_selectedView == GuestViewType::Thoughts) { - DrawTextEllipsised(rt, { 0, y }, 414, format, ft, { FontStyle::Small }); + DrawTextEllipsised(rt, { 0, y }, 414, format, ft, { FontStyle::small }); } else { @@ -755,7 +755,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(STR_GUESTS_COUNT_COMMA_SEP); ft.Add(group.NumGuests); - DrawTextBasic(rt, { 326, y }, format, ft, { TextAlignment::RIGHT }); + DrawTextBasic(rt, { 326, y }, format, ft, { TextAlignment::right }); } y += kSummarisedGuestsRowHeight; index++; diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 78c86b7314..8ee75bf41a 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -178,7 +178,7 @@ namespace OpenRCT2::Ui::Windows { // Scenery not available DrawTextEllipsised( - rt, screenPos, 308, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + rt, screenPos, 308, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::centre }); screenPos.y -= kListRowHeight; } } diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 0d08c94711..0e2de599f5 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -268,7 +268,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(gLandToolSize); screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->midY() }; DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } else if (_landToolMountainMode) { @@ -288,7 +288,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_landToolRaiseCost); - DrawTextBasic(rt, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::centre }); } screenCoords.y += 10; @@ -297,7 +297,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_landToolLowerCost); - DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::centre }); } screenCoords.y += 50; @@ -321,7 +321,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(price); - DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::centre }); } } } diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 8143e872d4..cfbf37b184 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -405,7 +405,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gLandToolSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } // Draw cost amount @@ -419,7 +419,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = { widgets[WIDX_PREVIEW].midX() + windowPos.x, widgets[WIDX_PREVIEW].bottom + windowPos.y + offset }; - DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::centre }); } } diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index ee09d4bb3a..e4f0b489f7 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -319,7 +320,7 @@ namespace OpenRCT2::Ui::Windows // Check how this date is represented (e.g. 2000-02-20, or 00/02/20) std::string date = Platform::FormatShortDate(long_time); - maxDateWidth = GfxGetStringWidth(date.c_str(), FontStyle::Medium) + kDateTimeGap; + maxDateWidth = GfxGetStringWidth(date.c_str(), FontStyle::medium) + kDateTimeGap; // Some locales do not use leading zeros for months and days, so let's try October, too. tm.tm_mon = 10; @@ -328,12 +329,12 @@ namespace OpenRCT2::Ui::Windows // Again, check how this date is represented (e.g. 2000-10-20, or 00/10/20) date = Platform::FormatShortDate(long_time); - maxDateWidth = std::max(maxDateWidth, GfxGetStringWidth(date.c_str(), FontStyle::Medium) + kDateTimeGap); + maxDateWidth = std::max(maxDateWidth, GfxGetStringWidth(date.c_str(), FontStyle::medium) + kDateTimeGap); // Time appears to be universally represented with two digits for minutes, so 12:00 or 00:00 should be // representable. std::string time = Platform::FormatTime(long_time); - maxTimeWidth = GfxGetStringWidth(time.c_str(), FontStyle::Medium) + kDateTimeGap; + maxTimeWidth = GfxGetStringWidth(time.c_str(), FontStyle::medium) + kDateTimeGap; } void LoadPreview() @@ -431,7 +432,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_preview.parkName.c_str()); DrawTextEllipsised( rt, namePos, previewPaneSize.width - kPadding * 2, STR_WINDOW_COLOUR_2_STRINGID, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); } const bool drawFrame = image != nullptr || targetType == PreviewImageType::screenshot; @@ -476,7 +477,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic( rt, textPos, previewText, {}, - { ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::CENTRE }); + { ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true), TextAlignment::centre }); return; } @@ -705,7 +706,7 @@ namespace OpenRCT2::Ui::Windows // Get 'Save' button string width auto saveLabel = LanguageGetString(STR_FILEBROWSER_SAVE_BUTTON); - auto saveLabelWidth = GfxGetStringWidth(saveLabel, FontStyle::Medium) + 12; + auto saveLabelWidth = GfxGetStringWidth(saveLabel, FontStyle::medium) + 12; widgets[WIDX_SAVE].type = WidgetType::button; widgets[WIDX_SAVE].top = height - paddingBottom - 15; @@ -715,7 +716,7 @@ namespace OpenRCT2::Ui::Windows // Get 'Filename:' string width auto filenameLabel = LanguageGetString(STR_FILENAME_LABEL); - auto filenameLabelWidth = GfxGetStringWidth(filenameLabel, FontStyle::Medium); + auto filenameLabelWidth = GfxGetStringWidth(filenameLabel, FontStyle::medium); widgets[WIDX_FILENAME_TEXTBOX].type = WidgetType::textBox; widgets[WIDX_FILENAME_TEXTBOX].top = height - paddingBottom - 15; @@ -740,7 +741,7 @@ namespace OpenRCT2::Ui::Windows { const auto& widget = widgets[WIDX_PARENT_FOLDER]; const auto pathWidth = widget.left - 8; - const auto shortPath = ShortenPath(_directory, pathWidth, FontStyle::Medium); + const auto shortPath = ShortenPath(_directory, pathWidth, FontStyle::medium); // Format text std::string buffer; @@ -1145,7 +1146,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_STRING); ft.Add(_listItems[i].dateFormatted.c_str()); DrawTextEllipsised( - rt, { dateAnchor - kDateTimeGap, y }, maxDateWidth, stringId, ft, { TextAlignment::RIGHT }); + rt, { dateAnchor - kDateTimeGap, y }, maxDateWidth, stringId, ft, { TextAlignment::right }); ft = Formatter(); ft.Add(STR_STRING); diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 3e02d2b62c..a596b81052 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -1233,7 +1233,7 @@ namespace OpenRCT2::Ui::Windows for (uint32_t i = 0; i < 4; i++) { const auto* labelStr = LanguageGetString(MapLabels[i]); - _firstColumnWidth = std::max(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium), _firstColumnWidth); + _firstColumnWidth = std::max(textOffset + GfxGetStringWidth(labelStr, FontStyle::medium), _firstColumnWidth); } textOffset += _firstColumnWidth + 4; @@ -1242,7 +1242,7 @@ namespace OpenRCT2::Ui::Windows { const auto* labelStr = LanguageGetString(MapLabels[i]); minWidth = std::max( - static_cast(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium)), minWidth); + static_cast(textOffset + GfxGetStringWidth(labelStr, FontStyle::medium)), minWidth); } width = std::max(minWidth, width); _recalculateScrollbars = true; diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index 0f5e356e61..2d43802b0c 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -56,7 +56,7 @@ namespace OpenRCT2::Ui::Windows } auto stringCoords = windowPos + ScreenCoordsXY{ width / 2, height / 2 }; - DrawTextWrapped(rt, stringCoords, width, STR_MAP_TOOLTIP_STRINGID, _mapTooltipArgs, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, width, STR_MAP_TOOLTIP_STRINGID, _mapTooltipArgs, { TextAlignment::centre }); } }; diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 17b58364d1..9f59788ace 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -289,7 +290,7 @@ namespace OpenRCT2::Ui::Windows _buffer += Network::GetPlayerName(player); } screenCoords.x = 0; - GfxClipString(_buffer.data(), 230, FontStyle::Medium); + GfxClipString(_buffer.data(), 230, FontStyle::medium); DrawText(rt, screenCoords, { colour }, _buffer.c_str()); // Draw group name @@ -300,7 +301,7 @@ namespace OpenRCT2::Ui::Windows _buffer += "{BLACK}"; screenCoords.x = 173; _buffer += Network::GetGroupName(group); - GfxClipString(_buffer.data(), 80, FontStyle::Medium); + GfxClipString(_buffer.data(), 80, FontStyle::medium); DrawText(rt, screenCoords, { colour }, _buffer.c_str()); } @@ -360,7 +361,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_buffer.c_str()); DrawTextEllipsised( rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); } auto screenPos = windowPos @@ -384,7 +385,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_buffer.c_str()); DrawTextEllipsised( rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); } } @@ -465,7 +466,7 @@ namespace OpenRCT2::Ui::Windows { assert(!_windowInformationSize.has_value()); - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::medium); // Base dimensions. const int32_t baseWidth = 450; @@ -474,7 +475,7 @@ namespace OpenRCT2::Ui::Windows // Server name is displayed word-wrapped, so figure out how high it will be. { int32_t numLines; - GfxWrapString(Network::GetServerName(), baseWidth, FontStyle::Medium, nullptr, &numLines); + GfxWrapString(Network::GetServerName(), baseWidth, FontStyle::medium, nullptr, &numLines); baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2); } @@ -483,7 +484,7 @@ namespace OpenRCT2::Ui::Windows if (!descString.empty()) { int32_t numLines; - GfxWrapString(descString, baseWidth, FontStyle::Medium, nullptr, &numLines); + GfxWrapString(descString, baseWidth, FontStyle::medium, nullptr, &numLines); baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2); } diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index 6f3f63ab64..8201902086 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -93,10 +93,10 @@ namespace OpenRCT2::Ui::Windows _buffer.assign("{WHITE}"); _buffer += _windowNetworkStatusText; - GfxClipString(_buffer.data(), widgets[WIDX_BACKGROUND].right - 50, FontStyle::Medium); + 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; + screenCoords.x -= GfxGetStringWidth(_buffer, FontStyle::medium) / 2; DrawText(rt, screenCoords, { COLOUR_BLACK }, _buffer.c_str()); } diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 8f7525c993..d02246cc27 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows const auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); auto string = ls.GetString(STR_GROUP_BY_TRACK_TYPE); - auto strWidth = GfxGetStringWidth(string, FontStyle::Medium); + auto strWidth = GfxGetStringWidth(string, FontStyle::medium); auto localizedGroupByTrackTypeWidth = strWidth + 14; widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth; } @@ -978,7 +978,7 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(price); - DrawTextBasic(rt, screenPos + ScreenCoordsXY{ textWidth, 51 }, stringId, ft, { TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos + ScreenCoordsXY{ textWidth, 51 }, stringId, ft, { TextAlignment::right }); } // Draw object author(s) if debugging tools are active @@ -1001,7 +1001,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised( rt, screenPos + ScreenCoordsXY{ textWidth, 0 }, kWindowSize.width - 2, STR_WINDOW_COLOUR_2_STRINGID, ft, - { TextAlignment::RIGHT }); + { TextAlignment::right }); } } diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 394800e40e..5bf08ec29c 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -113,7 +113,7 @@ namespace OpenRCT2::Ui::Windows static int32_t CalculateNewsItemHeight() { - return 4 * FontGetLineHeight(FontStyle::Small) + 2; + return 4 * FontGetLineHeight(FontStyle::small) + 2; } void initNewsWidgets() @@ -443,7 +443,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { - int32_t lineHeight = FontGetLineHeight(FontStyle::Small); + int32_t lineHeight = FontGetLineHeight(FontStyle::small); int32_t itemHeight = CalculateNewsItemHeight(); int32_t y = 0; int32_t i = 0; @@ -476,7 +476,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(DateDayNames[newsItem.day - 1]); ft.Add(DateGameMonthNames[DateGetMonth(newsItem.monthYear)]); - DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::Small }); + DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::small }); } // Item text { @@ -484,7 +484,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(newsItem.text.c_str()); DrawTextWrapped( rt, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft, - { COLOUR_BRIGHT_GREEN, FontStyle::Small }); + { COLOUR_BRIGHT_GREEN, FontStyle::small }); } // Subject button if ((newsItem.typeHasSubject()) && !(newsItem.hasButton())) diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 471e03e2b0..6cd999da2d 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -2187,7 +2187,7 @@ namespace OpenRCT2::Ui::Windows // Get 'Clear' button string width auto clearLabel = LanguageGetString(STR_CLEAR_BUTTON); - auto clearLabelWidth = GfxGetStringWidth(clearLabel, FontStyle::Medium) + 12; + auto clearLabelWidth = GfxGetStringWidth(clearLabel, FontStyle::medium) + 12; widgets[WIDX_PATH_TO_RCT1_CLEAR].right = widgets[WIDX_PAGE_BACKGROUND].right - 12; widgets[WIDX_PATH_TO_RCT1_CLEAR].left = widgets[WIDX_PATH_TO_RCT1_BROWSE].right - clearLabelWidth; @@ -2200,7 +2200,7 @@ namespace OpenRCT2::Ui::Windows // Get 'Browse' button string width auto browseLabel = LanguageGetString(STR_BROWSE); - auto browseLabelWidth = GfxGetStringWidth(browseLabel, FontStyle::Medium) + 12; + auto browseLabelWidth = GfxGetStringWidth(browseLabel, FontStyle::medium) + 12; widgets[WIDX_PATH_TO_RCT1_BROWSE].right = widgets[WIDX_PAGE_BACKGROUND].right - 12; widgets[WIDX_PATH_TO_RCT1_BROWSE].left = widgets[WIDX_PATH_TO_RCT1_BROWSE].right - browseLabelWidth; @@ -2241,7 +2241,7 @@ namespace OpenRCT2::Ui::Windows int32_t widgetHeight = pathWidget.bottom - pathWidget.top; // Apply vertical alignment if font height requires it - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::medium); int32_t padding = widgetHeight > lineHeight ? (widgetHeight - lineHeight) / 2 : 0; auto screenCoords = windowPos + ScreenCoordsXY{ pathWidget.left + 1, pathWidget.top + padding }; diff --git a/src/openrct2-ui/windows/OverwritePrompt.cpp b/src/openrct2-ui/windows/OverwritePrompt.cpp index 684ae34c24..30f41c9cec 100644 --- a/src/openrct2-ui/windows/OverwritePrompt.cpp +++ b/src/openrct2-ui/windows/OverwritePrompt.cpp @@ -94,7 +94,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_name.c_str()); ScreenCoordsXY stringCoords(windowPos.x + width / 2, windowPos.y + (height / 2) - 3); - DrawTextWrapped(rt, stringCoords, width - 4, STR_FILEBROWSER_OVERWRITE_PROMPT, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, width - 4, STR_FILEBROWSER_OVERWRITE_PROMPT, ft, { TextAlignment::centre }); } }; diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index b7538e7dd8..8812c1be1a 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -605,7 +605,7 @@ namespace OpenRCT2::Ui::Windows auto* labelWidget = &widgets[WIDX_STATUS]; DrawTextEllipsised( rt, windowPos + ScreenCoordsXY{ labelWidget->midX(), labelWidget->top }, labelWidget->width(), STR_BLACK_STRING, - ft, { TextAlignment::CENTRE }); + ft, { TextAlignment::centre }); } void initViewport() @@ -692,7 +692,7 @@ namespace OpenRCT2::Ui::Windows char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{COMMA32}", _ratingProps.max); - int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1; + int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1; const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y }; _ratingProps.RecalculateLayout( @@ -773,7 +773,7 @@ namespace OpenRCT2::Ui::Windows char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{BLACK}{COMMA32}", _guestProps.max); - int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::Small) + Graph::kYTickMarkPadding + 1; + int32_t maxGraphWidth = GfxGetStringWidth(buffer, FontStyle::small) + Graph::kYTickMarkPadding + 1; const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y }; _guestProps.RecalculateLayout( diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index c27ca7d179..dab5a095d4 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -148,7 +148,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gLandToolSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } } diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index a1fe1a599e..62c0c2f12c 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -440,7 +440,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised( rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); } // Draw ping @@ -466,7 +466,7 @@ namespace OpenRCT2::Ui::Windows { ft.Add(STR_ACTION_NA); } - DrawTextEllipsised(rt, screenCoords, updatedWidth, STR_LAST_ACTION_RAN, ft, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenCoords, updatedWidth, STR_LAST_ACTION_RAN, ft, { TextAlignment::centre }); if (viewport != nullptr && _drawViewport) { diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index 3965e914e2..56f9eb7540 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_demolishRideCost / 2); ScreenCoordsXY stringCoords(windowPos.x + kWindowSize.width / 2, windowPos.y + (kWindowSize.height / 2) - 3); - DrawTextWrapped(rt, stringCoords, kWindowSize.width - 4, stringId, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, kWindowSize.width - 4, stringId, ft, { TextAlignment::centre }); } } }; diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 877dd5d086..aae03f3725 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -2609,7 +2609,7 @@ namespace OpenRCT2::Ui::Windows auto* widget = &widgets[WIDX_VIEW]; DrawTextBasic( rt, { windowPos.x + (widget->left + widget->right - 11) / 2, windowPos.y + widget->top }, - STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE }); + STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::centre }); // Status ft = Formatter(); @@ -2617,7 +2617,7 @@ namespace OpenRCT2::Ui::Windows StringId rideStatus = GetStatus(ft); DrawTextEllipsised( rt, windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top }, widget->width(), rideStatus, - ft, { TextAlignment::CENTRE }); + ft, { TextAlignment::centre }); } #pragma endregion @@ -2875,7 +2875,7 @@ namespace OpenRCT2::Ui::Windows // Description auto ft = Formatter(); ft.Add(rideEntry->naming.Description); - screenCoords.y += DrawTextWrapped(rt, screenCoords, 300, STR_BLACK_STRING, ft, { TextAlignment::LEFT }); + screenCoords.y += DrawTextWrapped(rt, screenCoords, 300, STR_BLACK_STRING, ft, { TextAlignment::left }); screenCoords.y += 2; // Capacity @@ -2898,7 +2898,7 @@ namespace OpenRCT2::Ui::Windows // Intensity Factor if (rideEntry->intensity_multiplier != 0) { - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::medium); if (lineHeight != 10) screenCoords.x += 150; else @@ -4120,7 +4120,7 @@ namespace OpenRCT2::Ui::Windows { if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE) { - DrawTextWrapped(rt, screenCoords, 280, stringId, {}, { TextAlignment::LEFT }); + DrawTextWrapped(rt, screenCoords, 280, stringId, {}, { TextAlignment::left }); } else { @@ -4129,7 +4129,7 @@ namespace OpenRCT2::Ui::Windows { ft = Formatter(); staff->FormatNameTo(ft); - DrawTextWrapped(rt, screenCoords, 280, stringId, ft, { TextAlignment::LEFT }); + DrawTextWrapped(rt, screenCoords, 280, stringId, ft, { TextAlignment::left }); } } } @@ -5155,8 +5155,8 @@ namespace OpenRCT2::Ui::Windows if (track->Name.empty()) continue; - auto nameWidth = GfxGetStringWidth(track->Name.c_str(), FontStyle::Small); - auto composerWidth = GfxGetStringWidth(track->Composer.c_str(), FontStyle::Small); + auto nameWidth = GfxGetStringWidth(track->Name.c_str(), FontStyle::small); + auto composerWidth = GfxGetStringWidth(track->Composer.c_str(), FontStyle::small); newWidth = std::max(newWidth, nameWidth + composerWidth + 24); } @@ -5241,7 +5241,7 @@ namespace OpenRCT2::Ui::Windows // 'Tracks' caption auto trackLabelPos = windowPos + ScreenCoordsXY{ widgets[WIDX_MUSIC_DATA].left, widgets[WIDX_MUSIC_DATA].top - 13 }; - DrawTextWrapped(rt, trackLabelPos, width, STR_MUSIC_OBJECT_TRACK_HEADER, {}, { TextAlignment::LEFT }); + DrawTextWrapped(rt, trackLabelPos, width, STR_MUSIC_OBJECT_TRACK_HEADER, {}, { TextAlignment::left }); // Do we have a preview image to draw? auto musicObj = ride->getMusicObject(); @@ -5307,7 +5307,7 @@ namespace OpenRCT2::Ui::Windows : STR_MUSIC_OBJECT_TRACK_LIST_ITEM_WITH_COMPOSER; // Draw the track - DrawTextBasic(rt, { 0, y }, stringId, ft, { FontStyle::Small }); + DrawTextBasic(rt, { 0, y }, stringId, ft, { FontStyle::small }); y += kScrollableRowHeight; } } @@ -5616,7 +5616,7 @@ namespace OpenRCT2::Ui::Windows ScreenCoordsXY widgetCoords(windowPos.x + widget->width() / 2, windowPos.y + widget->top + 40); DrawTextWrapped( - rt, widgetCoords, width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, {}, { TextAlignment::CENTRE }); + rt, widgetCoords, width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, {}, { TextAlignment::centre }); widgetCoords.x = windowPos.x + 4; widgetCoords.y = windowPos.y + widgets[WIDX_SELECT_NEARBY_SCENERY].bottom + 17; @@ -6073,7 +6073,7 @@ namespace OpenRCT2::Ui::Windows // No measurement message ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() / 2 - 5); int32_t txtWidth = widget->width() - 2; - DrawTextWrapped(rt, stringCoords, txtWidth, message.str, message.args, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, txtWidth, message.str, message.args, { TextAlignment::centre }); return; } @@ -6124,7 +6124,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(scaled_yUnit); - DrawTextBasic(rt, { scrolls[0].contentOffsetX + 1, y - 4 }, stringID, ft, { FontStyle::Small }); + DrawTextBasic(rt, { scrolls[0].contentOffsetX + 1, y - 4 }, stringID, ft, { FontStyle::small }); } // Time marks @@ -6134,7 +6134,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(time); if (x + 80 >= rt.x) - DrawTextBasic(rt, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontStyle::Small }); + DrawTextBasic(rt, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontStyle::small }); time += 5; } @@ -6879,7 +6879,7 @@ namespace OpenRCT2::Ui::Windows stringId = queueTime == 1 ? STR_QUEUE_TIME_MINUTE : STR_QUEUE_TIME_MINUTES; ft = Formatter(); ft.Add(queueTime); - screenCoords.y += DrawTextWrapped(rt, screenCoords, 308, stringId, ft, { TextAlignment::LEFT }); + screenCoords.y += DrawTextWrapped(rt, screenCoords, 308, stringId, ft, { TextAlignment::left }); screenCoords.y += 5; } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index f9a4d9e45b..7fde5bdf83 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -1716,14 +1716,14 @@ namespace OpenRCT2::Ui::Windows // Draw cost screenCoords = { windowPos.x + widget->midX(), windowPos.y + widget->bottom - 23 }; if (_rideConstructionState != RideConstructionState::Place) - DrawTextBasic(rt, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::centre }); screenCoords.y += 11; if (_currentTrackPrice != kMoney64Undefined && !(getGameState().park.flags & PARK_FLAGS_NO_MONEY)) { auto ft = Formatter(); ft.Add(_currentTrackPrice); - DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::centre }); } } diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 5b57220234..23e6362855 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -306,12 +307,12 @@ namespace OpenRCT2::Ui::Windows drawWidgets(rt); StringId format = STR_WINDOW_COLOUR_2_STRINGID; - FontStyle fontStyle = FontStyle::Medium; + FontStyle fontStyle = FontStyle::medium; if (ScenarioSelectUseSmallFont()) { format = STR_SMALL_WINDOW_COLOUR_2_STRINGID; - fontStyle = FontStyle::Small; + fontStyle = FontStyle::small; } // Text for each tab @@ -325,7 +326,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(kScenarioOriginStringIds[i]); auto stringCoords = windowPos + ScreenCoordsXY{ widget.midX(), widget.midY() - 3 }; - DrawTextWrapped(rt, stringCoords, 87, format, ft, { COLOUR_AQUAMARINE, fontStyle, TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, 87, format, ft, { COLOUR_AQUAMARINE, fontStyle, TextAlignment::centre }); } auto previewPaneWidth = GetPreviewPaneWidth(); @@ -341,7 +342,7 @@ namespace OpenRCT2::Ui::Windows + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 }; DrawTextEllipsised( rt, screenPos + ScreenCoordsXY{ previewPaneWidth / 2, 0 }, previewPaneWidth, STR_SCENARIO_LOCKED, {}, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); DrawTextWrapped(rt, screenPos + ScreenCoordsXY{ 0, 15 }, previewPaneWidth, STR_SCENARIO_LOCKED_DESC); } @@ -359,7 +360,7 @@ namespace OpenRCT2::Ui::Windows // Scenario path if (Config::Get().general.debuggingTools) { - const auto shortPath = ShortenPath(scenario->Path, width - 6 - kTabWidth, FontStyle::Medium); + const auto shortPath = ShortenPath(scenario->Path, width - 6 - kTabWidth, FontStyle::medium); auto ft = Formatter(); ft.Add(shortPath.c_str()); @@ -374,7 +375,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(scenario->Name.c_str()); DrawTextEllipsised( rt, screenPos + ScreenCoordsXY{ previewPaneWidth / 2, 0 }, previewPaneWidth, STR_WINDOW_COLOUR_2_STRINGID, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); // Still loading the preview? if (_previewLoadJob.isValid()) @@ -383,7 +384,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_LOADING_GENERIC); DrawTextBasic( rt, screenPos + ScreenCoordsXY{ previewPaneWidth / 2, 15 }, STR_BLACK_STRING, ft, - { TextAlignment::CENTRE }); + { TextAlignment::centre }); return; } @@ -558,7 +559,7 @@ namespace OpenRCT2::Ui::Windows const int32_t scenarioItemHeight = GetScenarioListItemSize(); // Scenario title - int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::Medium); + int32_t scenarioTitleHeight = FontGetLineHeight(FontStyle::medium); int32_t y = 0; for (const auto& listItem : _listItems) @@ -599,12 +600,12 @@ namespace OpenRCT2::Ui::Windows ft.Add(scenario->Name.c_str()); auto colour = isDisabled ? colours[1].withFlag(ColourFlag::inset, true) : ColourWithFlags{ COLOUR_BLACK }; - auto darkness = isDisabled ? TextDarkness::Dark : TextDarkness::Regular; + auto darkness = isDisabled ? TextDarkness::dark : TextDarkness::regular; const auto scrollCentre = widgets[WIDX_SCENARIOLIST].width() / 2; DrawTextBasic( rt, { scrollCentre, y + 1 }, format, ft, - { colour, FontStyle::Medium, TextAlignment::CENTRE, darkness }); + { colour, FontStyle::medium, TextAlignment::centre, darkness }); // Check if scenario is completed if (isCompleted) @@ -624,7 +625,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(completedByName.c_str()); DrawTextBasic( rt, { scrollCentre, y + scenarioTitleHeight + 1 }, format, ft, - { FontStyle::Small, TextAlignment::CENTRE }); + { FontStyle::small, TextAlignment::centre }); } y += scenarioItemHeight; @@ -643,13 +644,13 @@ namespace OpenRCT2::Ui::Windows // Draw string int32_t centreX = (left + right) / 2; - DrawTextBasic(rt, { centreX, y }, stringId, {}, { baseColour, TextAlignment::CENTRE }); + DrawTextBasic(rt, { centreX, y }, stringId, {}, { baseColour, TextAlignment::centre }); // Get string dimensions utf8 buffer[512]; auto bufferPtr = buffer; OpenRCT2::FormatStringLegacy(bufferPtr, sizeof(buffer), stringId, nullptr); - int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::Medium) / 2) + 4; + int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::medium) / 2) + 4; int32_t strLeft = centreX - categoryStringHalfWidth; int32_t strRight = centreX + categoryStringHalfWidth; @@ -848,10 +849,10 @@ namespace OpenRCT2::Ui::Windows return kTrueFontSize; // Scenario title - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + int32_t lineHeight = FontGetLineHeight(FontStyle::medium); // 'Completed by' line - lineHeight += FontGetLineHeight(FontStyle::Small); + lineHeight += FontGetLineHeight(FontStyle::small); return lineHeight; } diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index d6da13d082..378c591eaf 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -849,7 +849,7 @@ namespace OpenRCT2::Ui::Windows // -14 DrawTextBasic( - rt, windowPos + ScreenCoordsXY{ width - 0x1A, height - 13 }, STR_COST_LABEL, ft, { TextAlignment::RIGHT }); + rt, windowPos + ScreenCoordsXY{ width - 0x1A, height - 13 }, STR_COST_LABEL, ft, { TextAlignment::right }); } auto ft = Formatter(); diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index 58b28e9282..6c9c1e99dd 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -193,7 +193,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gWindowSceneryScatterSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } } }; diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 8297e5aa96..1960cd1b1f 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -371,7 +371,7 @@ namespace OpenRCT2::Ui::Windows { snprintf(players, sizeof(players), "%d/%d", serverDetails.Players, serverDetails.MaxPlayers); } - const int16_t numPlayersStringWidth = GfxGetStringWidth(players, FontStyle::Medium); + const int16_t numPlayersStringWidth = GfxGetStringWidth(players, FontStyle::medium); // How much space we have for the server info depends on the size of everything rendered after. const int16_t spaceAvailableForInfo = listWidgetWidth - numPlayersStringWidth - kScrollBarWidth - 35; diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index 9443b9efb9..a04b199b40 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -137,7 +137,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(STR_STRING); ft.Add(_shortcutCustomName.c_str()); } - DrawTextWrapped(rt, stringCoords, 242, STR_SHORTCUT_CHANGE_PROMPT, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, stringCoords, 242, STR_SHORTCUT_CHANGE_PROMPT, ft, { TextAlignment::centre }); } private: diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 9352eec3c5..acaf6470fd 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -564,7 +564,7 @@ namespace OpenRCT2::Ui::Windows const auto& widget = widgets[WIDX_BTM_LABEL]; auto screenPos = windowPos + ScreenCoordsXY{ widget.midX(), widget.top }; int32_t widgetWidth = widget.width(); - DrawTextEllipsised(rt, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::centre }); } void DrawOverviewTabImage(RenderTarget& rt) diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index 8c3a79eb02..cf94694324 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -87,7 +87,7 @@ namespace OpenRCT2::Ui::Windows peep->FormatNameTo(ft); ScreenCoordsXY textCoords(windowPos + ScreenCoordsXY{ kWindowSize.width / 2, (kWindowSize.height / 2) - 3 }); - DrawTextWrapped(rt, textCoords, kWindowSize.width - 4, STR_FIRE_STAFF_ID, ft, { TextAlignment::CENTRE }); + DrawTextWrapped(rt, textCoords, kWindowSize.width - 4, STR_FIRE_STAFF_ID, ft, { TextAlignment::centre }); } }; diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index d38ca289c3..7746bf6773 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -208,13 +208,13 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_description.c_str()); - DrawTextWrapped(rt, screenCoords, kWindowSize.width, STR_STRING, ft, { colours[1], TextAlignment::CENTRE }); + DrawTextWrapped(rt, screenCoords, kWindowSize.width, STR_STRING, ft, { colours[1], TextAlignment::centre }); } else { DrawTextWrapped( rt, screenCoords, kWindowSize.width, _descriptionStringId, _descriptionArgs, - { colours[1], TextAlignment::CENTRE }); + { colours[1], TextAlignment::centre }); } screenCoords.y += 25; @@ -223,7 +223,7 @@ namespace OpenRCT2::Ui::Windows // +13 for cursor when max length. u8string wrappedString; GfxWrapString( - u8string_view{ _buffer.data(), _buffer.size() }, kWindowSize.width - (24 + 13), FontStyle::Medium, + u8string_view{ _buffer.data(), _buffer.size() }, kWindowSize.width - (24 + 13), FontStyle::medium, &wrappedString, &no_lines); Rectangle::fillInset( @@ -245,7 +245,7 @@ namespace OpenRCT2::Ui::Windows for (int32_t line = 0; line <= no_lines; line++) { screenCoords.x = windowPos.x + 12; - DrawText(rt, screenCoords, { colours[1], FontStyle::Medium, TextAlignment::LEFT }, wrapPointer, true); + DrawText(rt, screenCoords, { colours[1], FontStyle::medium, TextAlignment::left }, wrapPointer, true); size_t string_length = GetStringSize(wrapPointer) - 1; if (!cur_drawn && (textInput->SelectionStart <= char_count + string_length)) @@ -253,7 +253,7 @@ namespace OpenRCT2::Ui::Windows // Make a view of the string for measuring the width. cursorX = windowPos.x + 13 + GfxGetStringWidthNoFormatting( - u8string_view{ wrapPointer, textInput->SelectionStart - char_count }, FontStyle::Medium); + u8string_view{ wrapPointer, textInput->SelectionStart - char_count }, FontStyle::medium); cursorY = screenCoords.y; int32_t textWidth = 6; @@ -264,7 +264,7 @@ namespace OpenRCT2::Ui::Windows utf8 tmp[5] = {}; // This is easier than setting temp_string[0..5] uint32_t codepoint = UTF8GetNext(_buffer.data() + textInput->SelectionStart, nullptr); UTF8WriteCodepoint(tmp, codepoint); - textWidth = std::max(GfxGetStringWidthNoFormatting(tmp, FontStyle::Medium) - 2, 4); + textWidth = std::max(GfxGetStringWidthNoFormatting(tmp, FontStyle::medium) - 2, 4); } if (_cursorBlink > 15) @@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows { // String length needs to add 12 either side of box +13 for cursor when max length. int32_t numLines{}; - GfxWrapString(text, kWindowSize.width - (24 + 13), FontStyle::Medium, nullptr, &numLines); + GfxWrapString(text, kWindowSize.width - (24 + 13), FontStyle::medium, nullptr, &numLines); const auto textHeight = numLines * 10; return kWindowSize.height + textHeight + getTitleBarDiffNormal(); diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 8321fc1b1b..d706193b6e 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -702,7 +703,7 @@ namespace OpenRCT2::Ui::Windows else { auto colour = ThemeGetColour(wc, _buttonIndex); - colour.setFlag(ColourFlag::translucent, !colour.hasFlag(ColourFlag::translucent)); + colour.flags.flip(ColourFlag::translucent); ThemeSetColour(wc, _buttonIndex, colour); ColourSchemeUpdateAll(); @@ -721,7 +722,7 @@ namespace OpenRCT2::Ui::Windows if (_selectedTab == WINDOW_THEMES_TAB_SETTINGS || _selectedTab == WINDOW_THEMES_TAB_FEATURES) return; - if (!colours[1].hasFlag(ColourFlag::translucent)) + if (!colours[1].flags.has(ColourFlag::translucent)) // Rectangle::fill(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, // ColourMapA[colours[1].colour].mid_light); GfxClear(rt, ColourMapA[colours[1].colour].mid_light); @@ -759,7 +760,7 @@ namespace OpenRCT2::Ui::Windows screenCoords.y + _max_row_height - colorOffset + 1 }; auto yPixelOffset = ScreenCoordsXY{ 0, 1 }; - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) { TranslucentWindowPalette windowPalette = kTranslucentWindowPalettes[colour.colour]; @@ -799,10 +800,10 @@ namespace OpenRCT2::Ui::Windows Rectangle::fillInset( rt, { topLeft, bottomRight }, colours[1], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::dark, Rectangle::FillMode::dontLightenWhenInset); - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) { DrawText( - rt, topLeft, { colours[1].colour, FontStyle::Medium, TextDarkness::Dark }, kCheckMarkString); + rt, topLeft, { colours[1].colour, FontStyle::medium, TextDarkness::dark }, kCheckMarkString); } } } @@ -863,7 +864,7 @@ namespace OpenRCT2::Ui::Windows std::string str = FormatStringIDLegacy(format, args); - return GfxGetStringWidth(str, FontStyle::Medium); + return GfxGetStringWidth(str, FontStyle::medium); } int8_t GetTotalColoursUpTo(int8_t index) diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index d89e42f878..0e46a2e415 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1060,12 +1060,12 @@ static uint64_t PageDisabledWidgets[] = { ft.Add(tileCoords.x); DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ 43, yOffset }, STR_FORMAT_INTEGER, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); ft = Formatter(); ft.Add(tileCoords.y); DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ 113, yOffset }, STR_FORMAT_INTEGER, ft, - { colours[1], TextAlignment::RIGHT }); + { colours[1], TextAlignment::right }); } else { @@ -1595,9 +1595,9 @@ static uint64_t PageDisabledWidgets[] = { { auto& listWidget = widgets[WIDX_LIST]; auto centrePos = ScreenCoordsXY{ listWidget.width() / 2, - (listWidget.height() - FontGetLineHeight(FontStyle::Medium)) / 2 }; + (listWidget.height() - FontGetLineHeight(FontStyle::medium)) / 2 }; auto ft = Formatter{}; - auto textPaint = TextPaint{ colours[1], TextAlignment::CENTRE }; + auto textPaint = TextPaint{ colours[1], TextAlignment::centre }; DrawTextWrapped(rt, centrePos, listWidth, STR_TILE_INSPECTOR_SELECT_TILE_HINT, ft, textPaint); return; } diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index e6eb8a3e53..55b4041693 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 1df47588f6..62e6dac5ea 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/src/openrct2-ui/windows/TitleVersion.cpp b/src/openrct2-ui/windows/TitleVersion.cpp index 3f4b0263c0..fe9999d5f1 100644 --- a/src/openrct2-ui/windows/TitleVersion.cpp +++ b/src/openrct2-ui/windows/TitleVersion.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace OpenRCT2::Ui::Windows @@ -28,12 +29,12 @@ namespace OpenRCT2::Ui::Windows // Write name and version information const auto whiteOutline = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true); DrawText(rt, windowPos, { whiteOutline }, gVersionInfoFull); - width = GfxGetStringWidth(gVersionInfoFull, FontStyle::Medium); + width = GfxGetStringWidth(gVersionInfoFull, FontStyle::medium); // Write platform information constexpr const char platformInfo[] = OPENRCT2_PLATFORM " (" OPENRCT2_ARCHITECTURE ")"; DrawText(rt, windowPos + ScreenCoordsXY(0, kListRowHeight), { whiteOutline }, platformInfo); - width = std::max(width, GfxGetStringWidth(platformInfo, FontStyle::Medium)) + kTextOffset; + width = std::max(width, GfxGetStringWidth(platformInfo, FontStyle::medium)) + kTextOffset; } }; diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index ddcc86ffdd..ceb503f1e3 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -43,7 +43,7 @@ namespace OpenRCT2::Ui::Windows TooltipWindow(const OpenRCT2String& message, ScreenCoordsXY screenCoords) { _textWidth = FormatTextForTooltip(message); - _textHeight = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::Small)); + _textHeight = ((_tooltipNumLines + 1) * FontGetLineHeight(FontStyle::small)); width = _textWidth + 5; height = _textHeight + 4; @@ -130,7 +130,7 @@ namespace OpenRCT2::Ui::Windows // Text left = windowPos.x + ((width + 1) / 2) - 1; top = windowPos.y + 1; - DrawStringCentredRaw(rt, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::Small); + DrawStringCentredRaw(rt, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::small); } private: @@ -143,11 +143,11 @@ namespace OpenRCT2::Ui::Windows formattedMessage.args.Add(tempString.c_str()); const u8string tooltipTextUnwrapped = FormatStringIDLegacy(formattedMessage.str, formattedMessage.args.Data()); - auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::Small); + auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::small); textWidth = std::min(textWidth, 196); int32_t numLines; - textWidth = GfxWrapString(tooltipTextUnwrapped, textWidth + 1, FontStyle::Small, &_tooltipText, &numLines); + textWidth = GfxWrapString(tooltipTextUnwrapped, textWidth + 1, FontStyle::small, &_tooltipText, &numLines); _tooltipNumLines = numLines; return textWidth; } diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 1ea3a557e9..e05276f6c7 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -1422,7 +1423,7 @@ namespace OpenRCT2::Ui::Windows auto colour = ColourWithFlags{ COLOUR_DARK_ORANGE }.withFlag(ColourFlag::withOutline, true); DrawTextBasic( rt, screenPos + ScreenCoordsXY{ 26, 2 }, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, {}, - { colour, TextAlignment::RIGHT }); + { colour, TextAlignment::right }); } } @@ -1486,7 +1487,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(Network::GetNumVisiblePlayers()); auto colour = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true); - DrawTextBasic(rt, screenPos + ScreenCoordsXY{ 23, 1 }, STR_COMMA16, ft, { colour, TextAlignment::RIGHT }); + DrawTextBasic(rt, screenPos + ScreenCoordsXY{ 23, 1 }, STR_COMMA16, ft, { colour, TextAlignment::right }); } if (widgets[WIDX_ROTATE_ANTI_CLOCKWISE].type != WidgetType::empty) diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index 36df5ef85b..d4f9ec98a3 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -189,7 +189,7 @@ namespace OpenRCT2::Ui::Windows const auto titleBarBottom = widgets[WIDX_TITLE].bottom; const auto buttonTop = widgets[WIDX_PROMPT_DELETE].top; - const auto fontHeight = FontGetLineHeight(FontStyle::Medium); + const auto fontHeight = FontGetLineHeight(FontStyle::medium); const auto maxMessageHeight = buttonTop - titleBarBottom; const auto messageTop = titleBarBottom + (maxMessageHeight - fontHeight) / 2; @@ -198,7 +198,7 @@ namespace OpenRCT2::Ui::Windows ft.Add(_trackDesignFileReference->name.c_str()); DrawTextWrapped( rt, windowPos + ScreenCoordsXY{ width / 2, messageTop }, (width - 4), - STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::CENTRE }); + STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::centre }); } }; /** diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 459ad9b5a9..b8f1db2c44 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -376,7 +376,7 @@ namespace OpenRCT2::Ui::Windows { ft = Formatter(); ft.Add(_placementCost); - DrawTextBasic(rt, this->windowPos + ScreenCoordsXY{ 88, 94 }, STR_COST_LABEL, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, this->windowPos + ScreenCoordsXY{ 88, 94 }, STR_COST_LABEL, ft, { TextAlignment::centre }); } } diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 0c68ebf317..d577872c25 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -476,7 +476,7 @@ namespace OpenRCT2::Ui::Windows // Show track file path (in debug mode) if (Config::Get().general.debuggingTools) { - const auto shortPath = ShortenPath(path, width, FontStyle::Medium); + const auto shortPath = ShortenPath(path, width, FontStyle::medium); auto ft = Formatter(); ft.Add(shortPath.c_str()); DrawTextBasic( @@ -523,7 +523,7 @@ namespace OpenRCT2::Ui::Windows && !(gLegacyScene == LegacyScene::trackDesignsManager)) { // Vehicle design not available - DrawTextEllipsised(rt, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::centre }); screenPos.y -= kScrollableRowHeight; } @@ -533,7 +533,7 @@ namespace OpenRCT2::Ui::Windows { // Scenery not available DrawTextEllipsised( - rt, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE }); + rt, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::centre }); screenPos.y -= kScrollableRowHeight; } } @@ -541,7 +541,7 @@ namespace OpenRCT2::Ui::Windows // Track design name auto ft = Formatter(); ft.Add(_trackDesigns[trackIndex].name.c_str()); - DrawTextEllipsised(rt, screenPos, 368, STR_TRACK_PREVIEW_NAME_FORMAT, ft, { TextAlignment::CENTRE }); + DrawTextEllipsised(rt, screenPos, 368, STR_TRACK_PREVIEW_NAME_FORMAT, ft, { TextAlignment::centre }); // Information screenPos = windowPos + ScreenCoordsXY{ tdWidget.left + 1, tdWidget.bottom + 2 }; diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 79313f9f7f..b8af23f4ad 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -161,7 +161,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add(gLandToolSize); DrawTextBasic( - rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE }); + rt, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::centre }); } if (!(getGameState().park.flags & PARK_FLAGS_NO_MONEY)) @@ -172,7 +172,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_waterToolRaiseCost); - DrawTextBasic(rt, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::centre }); } screenCoords.y += 10; @@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(_waterToolLowerCost); - DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::centre }); } } } diff --git a/src/openrct2/core/FlagHolder.hpp b/src/openrct2/core/FlagHolder.hpp index b8d443c970..a63ac37620 100644 --- a/src/openrct2/core/FlagHolder.hpp +++ b/src/openrct2/core/FlagHolder.hpp @@ -67,6 +67,22 @@ struct FlagHolder holder |= EnumsToFlags(types...); } + template + constexpr FlagHolder with(TTypes... types) + { + FlagHolder res = *this; + res.set(types...); + return res; + } + + template + constexpr FlagHolder without(TTypes... types) + { + FlagHolder res = *this; + res.unset(types...); + return res; + } + /** * For situations where you don’t know upfront whether to set or unset the flag, * e.g. in game actions where this is passed as a variable. diff --git a/src/openrct2/drawing/Drawing.String.cpp b/src/openrct2/drawing/Drawing.String.cpp index 4961dcf6a4..0c151260f5 100644 --- a/src/openrct2/drawing/Drawing.String.cpp +++ b/src/openrct2/drawing/Drawing.String.cpp @@ -7,6 +7,8 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "../drawing/Drawing.String.h" + #include "../Context.h" #include "../SpriteIds.h" #include "../config/Config.h" @@ -17,6 +19,7 @@ #include "../drawing/IDrawingContext.h" #include "../drawing/IDrawingEngine.h" #include "../drawing/Text.h" +#include "../interface/ColourWithFlags.h" #include "../interface/Viewport.h" #include "../localisation/Formatting.h" #include "../localisation/LocalisationService.h" @@ -264,14 +267,14 @@ void GfxDrawStringLeftCentred( char buffer[512]; auto bufferPtr = buffer; FormatStringLegacy(bufferPtr, sizeof(buffer), format, args); - int32_t height = StringGetHeightRaw(bufferPtr, FontStyle::Medium); + int32_t height = StringGetHeightRaw(bufferPtr, FontStyle::medium); DrawText(rt, coords - ScreenCoordsXY{ 0, (height / 2) }, { colour }, bufferPtr); } /** * Changes the palette so that the next character changes colour */ -static void ColourCharacter(TextColour colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) +static void ColourCharacter(TextColour colour, bool withOutline, uint8_t* palette_pointer) { int32_t colour32 = 0; const G1Element* g1 = GfxGetG1Element(SPR_TEXT_PALETTE); @@ -281,7 +284,7 @@ static void ColourCharacter(TextColour colour, const uint16_t* current_font_flag std::memcpy(&colour32, &g1->offset[idx], sizeof(colour32)); } - if (!(*current_font_flags & TEXT_DRAW_FLAG_OUTLINE)) + if (!withOutline) { colour32 = colour32 & 0x0FF0000FF; } @@ -296,12 +299,12 @@ static void ColourCharacter(TextColour colour, const uint16_t* current_font_flag * Changes the palette so that the next character changes colour * This is specific to changing to a predefined window related colour */ -static void ColourCharacterWindow(colour_t colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) +static void ColourCharacterWindow(colour_t colour, bool withOutline, uint8_t* palette_pointer) { int32_t eax; eax = ColourMapA[colour].colour_11; - if (*current_font_flags & TEXT_DRAW_FLAG_OUTLINE) + if (withOutline) { eax |= 0x0A0A00; } @@ -350,9 +353,9 @@ void DrawStringCentredRaw( int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle) { int32_t height = 0; - if (fontStyle <= FontStyle::Medium) + if (fontStyle <= FontStyle::medium) height += 10; - else if (fontStyle == FontStyle::Tiny) + else if (fontStyle == FontStyle::tiny) height += 6; FmtString fmt(text); @@ -361,13 +364,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle) switch (token.kind) { case FormatToken::newline: - if (fontStyle == FontStyle::Small || fontStyle == FontStyle::Medium) + if (fontStyle == FontStyle::small || fontStyle == FontStyle::medium) { height += 10; break; } - if (fontStyle == FontStyle::Tiny) + if (fontStyle == FontStyle::tiny) { height += 6; break; @@ -375,13 +378,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle) height += 18; break; case FormatToken::newlineSmall: - if (fontStyle == FontStyle::Small || fontStyle == FontStyle::Medium) + if (fontStyle == FontStyle::small || fontStyle == FontStyle::medium) { height += 5; break; } - if (fontStyle == FontStyle::Tiny) + if (fontStyle == FontStyle::tiny) { height += 3; break; @@ -389,13 +392,13 @@ int32_t StringGetHeightRaw(std::string_view text, FontStyle fontStyle) height += 9; break; case FormatToken::fontTiny: - fontStyle = FontStyle::Tiny; + fontStyle = FontStyle::tiny; break; case FormatToken::fontMedium: - fontStyle = FontStyle::Medium; + fontStyle = FontStyle::medium; break; case FormatToken::fontSmall: - fontStyle = FontStyle::Small; + fontStyle = FontStyle::small; break; default: break; @@ -427,8 +430,8 @@ void DrawNewsTicker( DrawText(rt, screenCoords, { colour }, ""); u8string wrappedString; - GfxWrapString(FormatStringID(format, args), width, FontStyle::Small, &wrappedString, &numLines); - lineHeight = FontGetLineHeight(FontStyle::Small); + GfxWrapString(FormatStringID(format, args), width, FontStyle::small, &wrappedString, &numLines); + lineHeight = FontGetLineHeight(FontStyle::small); int32_t numCharactersDrawn = 0; int32_t numCharactersToDraw = ticks; @@ -437,7 +440,7 @@ void DrawNewsTicker( lineY = coords.y - ((numLines * lineHeight) / 2); for (int32_t line = 0; line <= numLines; line++) { - int32_t halfWidth = GfxGetStringWidth(buffer, FontStyle::Small) / 2; + int32_t halfWidth = GfxGetStringWidth(buffer, FontStyle::small) / 2; FmtString fmt(buffer); for (const auto& token : fmt) @@ -463,7 +466,7 @@ void DrawNewsTicker( } screenCoords = { coords.x - halfWidth, lineY }; - DrawText(rt, screenCoords, { kTextColour254, FontStyle::Small }, buffer); + DrawText(rt, screenCoords, { kTextColour254, FontStyle::small }, buffer); if (numCharactersDrawn > numCharactersToDraw) { @@ -477,15 +480,15 @@ void DrawNewsTicker( static void TTFDrawCharacterSprite(RenderTarget& rt, int32_t codepoint, TextDrawInfo* info) { - int32_t characterWidth = FontSpriteGetCodepointWidth(info->FontStyle, codepoint); - auto sprite = FontSpriteGetCodepointSprite(info->FontStyle, codepoint); + int32_t characterWidth = FontSpriteGetCodepointWidth(info->fontStyle, codepoint); + auto sprite = FontSpriteGetCodepointSprite(info->fontStyle, codepoint); - if (!(info->flags & TEXT_DRAW_FLAG_NO_DRAW)) + if (!info->textDrawFlags.has(TextDrawFlag::noDraw)) { auto screenCoords = ScreenCoordsXY{ info->x, info->y }; - if (info->flags & TEXT_DRAW_FLAG_Y_OFFSET_EFFECT) + if (info->textDrawFlags.has(TextDrawFlag::yOffsetEffect)) { - screenCoords.y += *info->y_offset++; + screenCoords.y += *info->yOffset++; } PaletteMap paletteMap(info->palette); @@ -511,14 +514,14 @@ static void TTFDrawStringRawTTF(RenderTarget& rt, std::string_view text, TextDra if (!TTFInitialise()) return; - TTFFontDescriptor* fontDesc = TTFGetFontFromSpriteBase(info->FontStyle); + TTFFontDescriptor* fontDesc = TTFGetFontFromSpriteBase(info->fontStyle); if (fontDesc->font == nullptr) { TTFDrawStringRawSprite(rt, text, info); return; } - if (info->flags & TEXT_DRAW_FLAG_NO_DRAW) + if (info->textDrawFlags.has(TextDrawFlag::noDraw)) { info->x += TTFGetWidthCacheGetOrAdd(fontDesc->font, text); return; @@ -551,43 +554,40 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token break; case FormatToken::newline: info->x = info->startX; - info->y += FontGetLineHeight(info->FontStyle); + info->y += FontGetLineHeight(info->fontStyle); break; case FormatToken::newlineSmall: info->x = info->startX; - info->y += FontGetLineHeightSmall(info->FontStyle); + info->y += FontGetLineHeightSmall(info->fontStyle); break; case FormatToken::fontTiny: - info->FontStyle = FontStyle::Tiny; + info->fontStyle = FontStyle::tiny; break; case FormatToken::fontSmall: - info->FontStyle = FontStyle::Small; + info->fontStyle = FontStyle::small; break; case FormatToken::fontMedium: - info->FontStyle = FontStyle::Medium; + info->fontStyle = FontStyle::medium; break; case FormatToken::outlineEnable: - info->flags |= TEXT_DRAW_FLAG_OUTLINE; + info->colourFlags.set(ColourFlag::withOutline); break; case FormatToken::outlineDisable: - info->flags &= ~TEXT_DRAW_FLAG_OUTLINE; + info->colourFlags.unset(ColourFlag::withOutline); break; case FormatToken::colourWindow1: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[0], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[0], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::colourWindow2: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[1], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[1], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::colourWindow3: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[2], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[2], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::inlineSprite: @@ -596,7 +596,7 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token auto g1 = GfxGetG1Element(imageId); if (g1 != nullptr && g1->width <= 32 && g1->height <= 32) { - if (!(info->flags & TEXT_DRAW_FLAG_NO_DRAW)) + if (!info->textDrawFlags.has(TextDrawFlag::noDraw)) { GfxDrawSprite(rt, imageId, { info->x, info->y }); } @@ -607,9 +607,8 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token default: if (FormatTokenIsColour(token.kind)) { - uint16_t flags = info->flags; auto colourIndex = FormatTokenToTextColour(token.kind); - ColourCharacter(colourIndex, &flags, info->palette); + ColourCharacter(colourIndex, info->colourFlags.has(ColourFlag::withOutline), info->palette); } break; } @@ -649,7 +648,7 @@ static bool ShouldUseSpriteForCodepoint(char32_t codepoint) static void TTFProcessStringLiteral(RenderTarget& rt, std::string_view text, TextDrawInfo* info) { #ifndef DISABLE_TTF - bool isTTF = info->flags & TEXT_DRAW_FLAG_TTF; + bool isTTF = info->textDrawFlags.has(TextDrawFlag::ttf); #else bool isTTF = false; #endif // DISABLE_TTF @@ -717,7 +716,7 @@ static void TTFProcessStringCodepoint(RenderTarget& rt, codepoint_t codepoint, T static void TTFProcessString(RenderTarget& rt, std::string_view text, TextDrawInfo* info) { - if (info->flags & TEXT_DRAW_FLAG_NO_FORMATTING) + if (info->textDrawFlags.has(TextDrawFlag::noFormatting)) { TTFProcessStringLiteral(rt, text, info); info->maxX = std::max(info->maxX, info->x); @@ -751,44 +750,34 @@ static void TTFProcessInitialColour(ColourWithFlags colour, TextDrawInfo* info) { if (colour.colour != kTextColour254 && colour.colour != kTextColour255) { - info->flags &= ~(TEXT_DRAW_FLAG_INSET | TEXT_DRAW_FLAG_OUTLINE); - if (colour.hasFlag(ColourFlag::withOutline)) + info->colourFlags = colour.flags; + if (!colour.flags.has(ColourFlag::inset)) { - info->flags |= TEXT_DRAW_FLAG_OUTLINE; - } - if (!colour.hasFlag(ColourFlag::inset)) - { - if (!(info->flags & TEXT_DRAW_FLAG_INSET)) - { - uint16_t flags = info->flags; - ColourCharacterWindow(colour.colour, &flags, reinterpret_cast(&info->palette)); - } + ColourCharacterWindow( + colour.colour, info->colourFlags.has(ColourFlag::withOutline), reinterpret_cast(&info->palette)); } else { - info->flags |= TEXT_DRAW_FLAG_INSET; - - uint32_t eax; - if (info->flags & TEXT_DRAW_FLAG_DARK) + uint32_t eax = 0; + switch (info->darkness) { - if (info->flags & TEXT_DRAW_FLAG_EXTRA_DARK) - { + case TextDarkness::extraDark: eax = ColourMapA[colour.colour].mid_light; eax = eax << 16; eax = eax | ColourMapA[colour.colour].dark; - } - else - { + break; + + case TextDarkness::dark: eax = ColourMapA[colour.colour].light; eax = eax << 16; eax = eax | ColourMapA[colour.colour].mid_dark; - } - } - else - { - eax = ColourMapA[colour.colour].lighter; - eax = eax << 16; - eax = eax | ColourMapA[colour.colour].mid_light; + break; + + case TextDarkness::regular: + eax = ColourMapA[colour.colour].lighter; + eax = eax << 16; + eax = eax | ColourMapA[colour.colour].mid_light; + break; } // Adjust text palette. Store current colour? ; @@ -807,31 +796,22 @@ void TTFDrawString( if (text == nullptr) return; - TextDrawInfo info; - info.FontStyle = fontStyle; - info.flags = 0; + TextDrawInfo info{}; + info.fontStyle = fontStyle; info.startX = coords.x; info.startY = coords.y; info.x = coords.x; info.y = coords.y; + info.darkness = darkness; if (LocalisationService_UseTrueTypeFont()) { - info.flags |= TEXT_DRAW_FLAG_TTF; + info.textDrawFlags.set(TextDrawFlag::ttf); } if (noFormatting) { - info.flags |= TEXT_DRAW_FLAG_NO_FORMATTING; - } - - if (darkness == TextDarkness::Dark) - { - info.flags |= TEXT_DRAW_FLAG_DARK; - } - else if (darkness == TextDarkness::ExtraDark) - { - info.flags |= (TEXT_DRAW_FLAG_DARK | TEXT_DRAW_FLAG_EXTRA_DARK); + info.textDrawFlags.set(TextDrawFlag::noFormatting); } std::memcpy(info.palette, gTextPalette, sizeof(info.palette)); @@ -844,9 +824,8 @@ void TTFDrawString( static int32_t TTFGetStringWidth(std::string_view text, FontStyle fontStyle, bool noFormatting) { - TextDrawInfo info; - info.FontStyle = fontStyle; - info.flags = 0; + TextDrawInfo info{}; + info.fontStyle = fontStyle; info.startX = 0; info.startY = 0; info.x = 0; @@ -854,15 +833,15 @@ static int32_t TTFGetStringWidth(std::string_view text, FontStyle fontStyle, boo info.maxX = 0; info.maxY = 0; - info.flags |= TEXT_DRAW_FLAG_NO_DRAW; + info.textDrawFlags.set(TextDrawFlag::noDraw); if (LocalisationService_UseTrueTypeFont()) { - info.flags |= TEXT_DRAW_FLAG_TTF; + info.textDrawFlags.set(TextDrawFlag::ttf); } if (noFormatting) { - info.flags |= TEXT_DRAW_FLAG_NO_FORMATTING; + info.textDrawFlags.set(TextDrawFlag::noFormatting); } RenderTarget dummy{}; @@ -879,20 +858,19 @@ void GfxDrawStringWithYOffsets( RenderTarget& rt, const utf8* text, ColourWithFlags colour, const ScreenCoordsXY& coords, const int8_t* yOffsets, bool forceSpriteFont, FontStyle fontStyle) { - TextDrawInfo info; - info.FontStyle = fontStyle; - info.flags = 0; + TextDrawInfo info{}; + info.fontStyle = fontStyle; info.startX = coords.x; info.startY = coords.y; info.x = coords.x; info.y = coords.y; - info.y_offset = yOffsets; + info.yOffset = yOffsets; - info.flags |= TEXT_DRAW_FLAG_Y_OFFSET_EFFECT; + info.textDrawFlags.set(TextDrawFlag::yOffsetEffect); if (!forceSpriteFont && LocalisationService_UseTrueTypeFont()) { - info.flags |= TEXT_DRAW_FLAG_TTF; + info.textDrawFlags.set(TextDrawFlag::ttf); } std::memcpy(info.palette, gTextPalette, sizeof(info.palette)); diff --git a/src/openrct2/drawing/Drawing.String.h b/src/openrct2/drawing/Drawing.String.h new file mode 100644 index 0000000000..8ef8e1432c --- /dev/null +++ b/src/openrct2/drawing/Drawing.String.h @@ -0,0 +1,44 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../core/FlagHolder.hpp" +#include "../interface/Colour.h" +#include "../interface/ColourWithFlags.h" + +#include + +enum class FontStyle : uint8_t; +enum class TextDarkness : uint8_t; + +enum class TextDrawFlag : uint8_t +{ + noFormatting, + yOffsetEffect, + ttf, + noDraw, +}; +using TextDrawFlags = FlagHolder; + +struct TextDrawInfo +{ + int32_t startX{}; + int32_t startY{}; + int32_t x{}; + int32_t y{}; + int32_t maxX{}; + int32_t maxY{}; + TextDrawFlags textDrawFlags{}; + OpenRCT2::ColourFlags colourFlags{}; + TextDarkness darkness{}; + uint8_t palette[8]{}; + FontStyle fontStyle{}; + const int8_t* yOffset{}; +}; diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 7e74dd397b..c32f59fdac 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -1139,8 +1139,8 @@ void DebugDPI(RenderTarget& rt) GfxDrawLine(rt, { topLeft, topLeft + ScreenCoordsXY{ 4, 0 } }, PaletteIndex::pi136); const auto str = std::to_string(rt.x); - DrawText(rt, ScreenCoordsXY{ rt.x, rt.y }, { COLOUR_WHITE, FontStyle::Tiny }, str.c_str()); + DrawText(rt, ScreenCoordsXY{ rt.x, rt.y }, { COLOUR_WHITE, FontStyle::tiny }, str.c_str()); const auto str2 = std::to_string(rt.y); - DrawText(rt, ScreenCoordsXY{ rt.x, rt.y + 6 }, { COLOUR_WHITE, FontStyle::Tiny }, str2.c_str()); + DrawText(rt, ScreenCoordsXY{ rt.x, rt.y + 6 }, { COLOUR_WHITE, FontStyle::tiny }, str2.c_str()); } diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 54f5a96810..ca70996546 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -32,6 +32,7 @@ struct ScreenRect; namespace OpenRCT2 { + struct ColourWithFlags; struct IPlatformEnvironment; struct IStream; } // namespace OpenRCT2 @@ -113,32 +114,6 @@ struct RenderTarget } }; -struct TextDrawInfo -{ - int32_t startX; - int32_t startY; - int32_t x; - int32_t y; - int32_t maxX; - int32_t maxY; - int32_t flags; - uint8_t palette[8]; - ::FontStyle FontStyle; - const int8_t* y_offset; -}; - -enum : uint32_t -{ - TEXT_DRAW_FLAG_INSET = 1 << 0, - TEXT_DRAW_FLAG_OUTLINE = 1 << 1, - TEXT_DRAW_FLAG_DARK = 1 << 2, - TEXT_DRAW_FLAG_EXTRA_DARK = 1 << 3, - TEXT_DRAW_FLAG_NO_FORMATTING = 1 << 28, - TEXT_DRAW_FLAG_Y_OFFSET_EFFECT = 1 << 29, - TEXT_DRAW_FLAG_TTF = 1 << 30, - TEXT_DRAW_FLAG_NO_DRAW = 1u << 31 -}; - struct RCTG1Element { uint32_t offset; // 0x00 note: uint32_t always! diff --git a/src/openrct2/drawing/Font.h b/src/openrct2/drawing/Font.h index e85678cb8f..fda084eee8 100644 --- a/src/openrct2/drawing/Font.h +++ b/src/openrct2/drawing/Font.h @@ -18,13 +18,13 @@ constexpr uint16_t kSpriteFontGlyphCount = 224; enum class FontStyle : uint8_t { - Small = 0, - Medium = 1, - Tiny = 2, + small = 0, + medium = 1, + tiny = 2, }; constexpr uint8_t FontStyleCount = 3; -constexpr std::array FontStyles = { FontStyle::Small, FontStyle::Medium, FontStyle::Tiny }; +constexpr std::array FontStyles = { FontStyle::small, FontStyle::medium, FontStyle::tiny }; #ifndef DISABLE_TTF diff --git a/src/openrct2/drawing/IDrawingContext.h b/src/openrct2/drawing/IDrawingContext.h index 4dd944fda5..5183296d4f 100644 --- a/src/openrct2/drawing/IDrawingContext.h +++ b/src/openrct2/drawing/IDrawingContext.h @@ -12,6 +12,8 @@ #include "Drawing.h" #include "TTF.h" +struct TextDrawInfo; + namespace OpenRCT2::Drawing { struct IDrawingEngine; diff --git a/src/openrct2/drawing/Rectangle.cpp b/src/openrct2/drawing/Rectangle.cpp index db5992c93e..d0bb871490 100644 --- a/src/openrct2/drawing/Rectangle.cpp +++ b/src/openrct2/drawing/Rectangle.cpp @@ -10,6 +10,7 @@ #include "Rectangle.h" #include "../interface/Colour.h" +#include "../interface/ColourWithFlags.h" #include "../world/Location.hpp" #include "Drawing.h" #include "IDrawingContext.h" @@ -49,7 +50,7 @@ namespace OpenRCT2::Drawing::Rectangle const auto leftBottom = ScreenCoordsXY{ rect.GetLeft(), rect.GetBottom() }; const auto rightTop = ScreenCoordsXY{ rect.GetRight(), rect.GetTop() }; const auto rightBottom = ScreenCoordsXY{ rect.GetRight(), rect.GetBottom() }; - if (colour.hasFlag(ColourFlag::translucent)) + if (colour.flags.has(ColourFlag::translucent)) { auto palette = kTranslucentWindowPalettes[colour.colour]; diff --git a/src/openrct2/drawing/Rectangle.h b/src/openrct2/drawing/Rectangle.h index f33629a41e..170be7df2a 100644 --- a/src/openrct2/drawing/Rectangle.h +++ b/src/openrct2/drawing/Rectangle.h @@ -11,11 +11,15 @@ #include -struct ColourWithFlags; enum class FilterPaletteID : int32_t; struct RenderTarget; struct ScreenRect; +namespace OpenRCT2 +{ + struct ColourWithFlags; +} + namespace OpenRCT2::Drawing::Rectangle { enum class BorderStyle : uint8_t diff --git a/src/openrct2/drawing/ScrollingText.cpp b/src/openrct2/drawing/ScrollingText.cpp index 3b571802ba..1f1f463b15 100644 --- a/src/openrct2/drawing/ScrollingText.cpp +++ b/src/openrct2/drawing/ScrollingText.cpp @@ -59,7 +59,7 @@ static void ScrollingTextInitialiseCharacterBitmaps(uint32_t glyphStart, uint16_ for (int32_t i = 0; i < count; i++) { std::fill_n(drawingSurface, sizeof(drawingSurface), 0x00); - GfxDrawSpriteSoftware(rt, ImageId(glyphStart + (EnumValue(FontStyle::Tiny) * count) + i), { -1, 0 }); + GfxDrawSpriteSoftware(rt, ImageId(glyphStart + (EnumValue(FontStyle::tiny) * count) + i), { -1, 0 }); for (int32_t x = 0; x < 8; x++) { @@ -1493,7 +1493,7 @@ static void ScrollingTextSetBitmapForSprite( CodepointView codepoints(token.text); for (auto codepoint : codepoints) { - auto characterWidth = FontSpriteGetCodepointWidth(FontStyle::Tiny, codepoint); + auto characterWidth = FontSpriteGetCodepointWidth(FontStyle::tiny, codepoint); auto characterBitmap = FontSpriteGetCodepointBitmap(codepoint); for (; characterWidth != 0; characterWidth--, characterBitmap++) { @@ -1541,7 +1541,7 @@ static void ScrollingTextSetBitmapForTTF( std::string_view text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets, colour_t colour) { #ifndef DISABLE_TTF - auto fontDesc = TTFGetFontFromSpriteBase(FontStyle::Tiny); + auto fontDesc = TTFGetFontFromSpriteBase(FontStyle::tiny); if (fontDesc->font == nullptr) { ScrollingTextSetBitmapForSprite(text, scroll, bitmap, scrollPositionOffsets, colour); diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index 03e3c04b10..5f377b5373 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -43,12 +43,12 @@ public: auto lineCoords = coords; switch (Paint.Alignment) { - case TextAlignment::LEFT: + case TextAlignment::left: break; - case TextAlignment::CENTRE: + case TextAlignment::centre: lineCoords.x += MaxWidth / 2; break; - case TextAlignment::RIGHT: + case TextAlignment::right: lineCoords.x += MaxWidth; break; } @@ -86,19 +86,19 @@ void DrawText(RenderTarget& rt, const ScreenCoordsXY& coords, const TextPaint& p auto alignedCoords = coords; switch (paint.Alignment) { - case TextAlignment::LEFT: + case TextAlignment::left: break; - case TextAlignment::CENTRE: + case TextAlignment::centre: alignedCoords.x -= (width - 1) / 2; break; - case TextAlignment::RIGHT: + case TextAlignment::right: alignedCoords.x -= width; break; } TTFDrawString(rt, text, paint.Colour, alignedCoords, noFormatting, paint.FontStyle, paint.Darkness); - if (paint.UnderlineText == TextUnderline::On) + if (paint.UnderlineText == TextUnderline::on) { Rectangle::fill( rt, { { alignedCoords + ScreenCoordsXY{ 0, 11 } }, { alignedCoords + ScreenCoordsXY{ width, 11 } } }, @@ -157,7 +157,7 @@ int32_t DrawTextWrapped( StaticLayout layout(OpenRCT2::FormatStringIDLegacy(format, args), textPaint, width); - if (textPaint.Alignment == TextAlignment::CENTRE) + if (textPaint.Alignment == TextAlignment::centre) { // The original tried to vertically centre the text, but used line count - 1 int32_t lineCount = layout.GetLineCount(); diff --git a/src/openrct2/drawing/Text.h b/src/openrct2/drawing/Text.h index d3606fa906..35f78423ce 100644 --- a/src/openrct2/drawing/Text.h +++ b/src/openrct2/drawing/Text.h @@ -10,12 +10,15 @@ #pragma once #include "../interface/Colour.h" +#include "../interface/ColourWithFlags.h" #include "../localisation/StringIdType.h" #include "Font.h" struct ScreenCoordsXY; struct RenderTarget; +using OpenRCT2::ColourWithFlags; + namespace OpenRCT2 { class Formatter; @@ -23,31 +26,31 @@ namespace OpenRCT2 enum class TextAlignment { - LEFT, - CENTRE, - RIGHT + left, + centre, + right, }; enum class TextUnderline { - Off, - On, + off, + on, }; -enum class TextDarkness +enum class TextDarkness : uint8_t { - Regular = 0, - Dark = 1, - ExtraDark = 2, + regular = 0, + dark = 1, + extraDark = 2, }; struct TextPaint { ColourWithFlags Colour = { COLOUR_BLACK }; - ::FontStyle FontStyle = FontStyle::Medium; - TextUnderline UnderlineText = TextUnderline::Off; - TextAlignment Alignment = TextAlignment::LEFT; - TextDarkness Darkness = TextDarkness::Regular; + ::FontStyle FontStyle = FontStyle::medium; + TextUnderline UnderlineText = TextUnderline::off; + TextAlignment Alignment = TextAlignment::left; + TextDarkness Darkness = TextDarkness::regular; TextPaint() = default; TextPaint(ColourWithFlags colour) diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index fc8731e7bb..d3aa7e21f4 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -18,6 +18,7 @@ #include "../interface/Window.h" #include "../scenes/intro/IntroScene.h" #include "../ui/UiContext.h" +#include "Drawing.String.h" #include "Drawing.h" #include "IDrawingContext.h" #include "IDrawingEngine.h" @@ -746,14 +747,14 @@ void X8DrawingContext::DrawTTFBitmap( const uint8_t fgColor = info->palette[1]; const uint8_t bgColor = info->palette[3]; - if (info->flags & TEXT_DRAW_FLAG_OUTLINE) + if (info->colourFlags.has(ColourFlag::withOutline)) { DrawTTFBitmapInternal(rt, bgColor, surface, x + 1, y, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x - 1, y, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x, y + 1, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x, y - 1, 0); } - if (info->flags & TEXT_DRAW_FLAG_INSET) + if (info->colourFlags.has(ColourFlag::inset)) { DrawTTFBitmapInternal(rt, bgColor, surface, x + 1, y + 1, 0); } diff --git a/src/openrct2/drawing/X8DrawingEngine.h b/src/openrct2/drawing/X8DrawingEngine.h index 6ed83b1f1a..a0825c35f7 100644 --- a/src/openrct2/drawing/X8DrawingEngine.h +++ b/src/openrct2/drawing/X8DrawingEngine.h @@ -15,6 +15,8 @@ #include +struct TextDrawInfo; + namespace OpenRCT2 { namespace Ui diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index d96e87ea49..cac1ffb4d0 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -108,7 +108,7 @@ void MoneyEffect::SetValue(money64 value) auto [stringId, newValue] = GetStringId(); char buffer[128]; OpenRCT2::FormatStringLegacy(buffer, 128, stringId, &newValue); - offsetX = -(GfxGetStringWidth(buffer, FontStyle::Medium) / 2); + offsetX = -(GfxGetStringWidth(buffer, FontStyle::medium) / 2); } OffsetX = offsetX; Wiggle = 0; diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index 743729cf25..c98d838b89 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -17,6 +17,7 @@ #include "../drawing/Drawing.h" #include "../drawing/Rectangle.h" #include "../drawing/Text.h" +#include "../interface/ColourWithFlags.h" #include "../localisation/Formatter.h" #include "../localisation/Formatting.h" #include "../network/Network.h" @@ -198,10 +199,10 @@ void ChatDraw(RenderTarget& rt, ColourWithFlags chatBackgroundColor) GfxSetDirtyBlocks({ screenCoords, { screenCoords + ScreenCoordsXY{ _chatWidth, inputLineHeight + 15 } } }); // TODO: Show caret if the input text has multiple lines - if (_chatCaretTicks < 15 && GfxGetStringWidth(lineBuffer, FontStyle::Medium) < (_chatWidth - 10)) + if (_chatCaretTicks < 15 && GfxGetStringWidth(lineBuffer, FontStyle::medium) < (_chatWidth - 10)) { lineBuffer.assign(_chatCurrentLine.c_str(), _chatTextInputSession->SelectionStart); - int32_t caretX = screenCoords.x + GfxGetStringWidth(lineBuffer, FontStyle::Medium); + int32_t caretX = screenCoords.x + GfxGetStringWidth(lineBuffer, FontStyle::medium); int32_t caretY = screenCoords.y + 14; Rectangle::fill(rt, { { caretX, caretY }, { caretX + 6, caretY + 1 } }, PaletteIndex::pi56); @@ -292,8 +293,8 @@ static int32_t ChatHistoryDrawString(RenderTarget& rt, const char* text, const S { int32_t numLines; u8string wrappedString; - GfxWrapString(FormatString("{OUTLINE}{WHITE}{STRING}", text), width, FontStyle::Medium, &wrappedString, &numLines); - auto lineHeight = FontGetLineHeight(FontStyle::Medium); + GfxWrapString(FormatString("{OUTLINE}{WHITE}{STRING}", text), width, FontStyle::medium, &wrappedString, &numLines); + auto lineHeight = FontGetLineHeight(FontStyle::medium); int32_t expectedY = screenCoords.y - (numLines * lineHeight); if (expectedY < 50) @@ -317,7 +318,7 @@ static int32_t ChatHistoryDrawString(RenderTarget& rt, const char* text, const S int32_t ChatStringWrappedGetHeight(u8string_view args, int32_t width) { int32_t numLines; - GfxWrapString(FormatStringID(STR_STRING, args), width, FontStyle::Medium, nullptr, &numLines); - const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + GfxWrapString(FormatStringID(STR_STRING, args), width, FontStyle::medium, nullptr, &numLines); + const int32_t lineHeight = FontGetLineHeight(FontStyle::medium); return lineHeight * (numLines + 1); } diff --git a/src/openrct2/interface/Chat.h b/src/openrct2/interface/Chat.h index 7079b5df47..f520e435c6 100644 --- a/src/openrct2/interface/Chat.h +++ b/src/openrct2/interface/Chat.h @@ -14,6 +14,11 @@ #include +namespace OpenRCT2 +{ + struct ColourWithFlags; +} + constexpr int8_t kChatHistorySize = 10; constexpr int16_t kChatInputSize = 1024; constexpr uint8_t kChatMaxMessageLength = 200; @@ -38,7 +43,7 @@ void ChatToggle(); void ChatInit(); void ChatUpdate(); -void ChatDraw(RenderTarget& rt, ColourWithFlags chatBackgroundColour); +void ChatDraw(RenderTarget& rt, OpenRCT2::ColourWithFlags chatBackgroundColour); void ChatAddHistory(std::string_view s); void ChatInput(ChatInput input); diff --git a/src/openrct2/interface/Colour.cpp b/src/openrct2/interface/Colour.cpp index 27a5b93d6d..ad818b3dc2 100644 --- a/src/openrct2/interface/Colour.cpp +++ b/src/openrct2/interface/Colour.cpp @@ -20,10 +20,6 @@ using namespace OpenRCT2::Drawing; ColourShadeMap ColourMapA[COLOUR_COUNT] = {}; -static constexpr uint8_t kLegacyColourMaskBase = 0x1F; -static constexpr uint8_t kLegacyColourFlagOutline = (1 << 5); -static constexpr uint8_t kLegacyColourFlagInset = (1 << 6); - enum { INDEX_COLOUR_0 = 243, @@ -210,44 +206,3 @@ BlendColourMapType* GetBlendColourMap() return nullptr; } #endif - -bool ColourWithFlags::hasFlag(ColourFlag flag) const -{ - return flags & EnumToFlag(flag); -} - -void ColourWithFlags::setFlag(ColourFlag flag, bool on) -{ - if (on) - flags |= EnumToFlag(flag); - else - flags &= ~EnumToFlag(flag); -} - -ColourWithFlags ColourWithFlags::withFlag(ColourFlag flag, bool on) const -{ - struct ColourWithFlags result = *this; - result.setFlag(flag, on); - return result; -} - -ColourWithFlags ColourWithFlags::fromLegacy(uint8_t legacy) -{ - ColourWithFlags result{}; - result.colour = legacy & kLegacyColourMaskBase; - if (legacy & kLegacyColourFlagTranslucent) - result.flags |= EnumToFlag(ColourFlag::translucent); - if (legacy & kLegacyColourFlagInset) - result.flags |= EnumToFlag(ColourFlag::inset); - if (legacy & kLegacyColourFlagOutline) - result.flags |= EnumToFlag(ColourFlag::withOutline); - - return result; -} - -ColourWithFlags& ColourWithFlags::operator=(colour_t rhs) -{ - colour = rhs; - flags = 0; - return *this; -} diff --git a/src/openrct2/interface/Colour.h b/src/openrct2/interface/Colour.h index 4dedb71547..9d1523964b 100644 --- a/src/openrct2/interface/Colour.h +++ b/src/openrct2/interface/Colour.h @@ -210,34 +210,9 @@ constexpr uint8_t kPaletteLengthAnimated = 16; constexpr uint8_t kColourNumOriginal = 32; constexpr uint8_t kColourNumNormal = 54; -static constexpr uint8_t kLegacyColourFlagTranslucent = (1 << 7); - constexpr colour_t kTextColour254 = 254; constexpr colour_t kTextColour255 = 255; -enum class ColourFlag : uint8_t -{ - translucent, - inset, - withOutline, -}; - -struct ColourWithFlags -{ - colour_t colour{}; - uint8_t flags{}; - - bool hasFlag(ColourFlag flag) const; - - void setFlag(ColourFlag flag, bool on); - - ColourWithFlags withFlag(ColourFlag flag, bool on) const; - - static ColourWithFlags fromLegacy(uint8_t legacy); - - ColourWithFlags& operator=(colour_t rhs); -}; - struct ColourShadeMap { PaletteIndex colour_0; diff --git a/src/openrct2/interface/ColourWithFlags.cpp b/src/openrct2/interface/ColourWithFlags.cpp new file mode 100644 index 0000000000..8ebd645551 --- /dev/null +++ b/src/openrct2/interface/ColourWithFlags.cpp @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "ColourWithFlags.h" + +namespace OpenRCT2 +{ + static constexpr uint8_t kLegacyColourMaskBase = 0x1F; + static constexpr uint8_t kLegacyColourFlagOutline = (1 << 5); + static constexpr uint8_t kLegacyColourFlagInset = (1 << 6); + + ColourWithFlags ColourWithFlags::withFlag(ColourFlag flag, bool on) const + { + struct ColourWithFlags result = *this; + result.flags.set(flag, on); + return result; + } + + ColourWithFlags ColourWithFlags::fromLegacy(uint8_t legacy) + { + ColourWithFlags result{}; + result.colour = legacy & kLegacyColourMaskBase; + if (legacy & kLegacyColourFlagTranslucent) + result.flags.set(ColourFlag::translucent); + if (legacy & kLegacyColourFlagInset) + result.flags.set(ColourFlag::inset); + if (legacy & kLegacyColourFlagOutline) + result.flags.set(ColourFlag::withOutline); + + return result; + } + + ColourWithFlags& ColourWithFlags::operator=(colour_t rhs) + { + colour = rhs; + flags = {}; + return *this; + } +} // namespace OpenRCT2 diff --git a/src/openrct2/interface/ColourWithFlags.h b/src/openrct2/interface/ColourWithFlags.h new file mode 100644 index 0000000000..31301fd781 --- /dev/null +++ b/src/openrct2/interface/ColourWithFlags.h @@ -0,0 +1,41 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../core/FlagHolder.hpp" + +#include + +using colour_t = uint8_t; + +namespace OpenRCT2 +{ + constexpr uint8_t kLegacyColourFlagTranslucent = (1 << 7); + + enum class ColourFlag : uint8_t + { + translucent, + inset, + withOutline, + }; + using ColourFlags = FlagHolder; + + struct ColourWithFlags + { + colour_t colour{}; + ColourFlags flags{}; + + ColourWithFlags withFlag(ColourFlag flag, bool on) const; + + static ColourWithFlags fromLegacy(uint8_t legacy); + + ColourWithFlags& operator=(colour_t rhs); + }; +} // namespace OpenRCT2 diff --git a/src/openrct2/interface/Fonts.cpp b/src/openrct2/interface/Fonts.cpp index 54185412f8..f4f3873121 100644 --- a/src/openrct2/interface/Fonts.cpp +++ b/src/openrct2/interface/Fonts.cpp @@ -193,7 +193,7 @@ void TryLoadFonts(LocalisationService& localisationService) return; } - TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::Small)]; + TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::small)]; LOG_VERBOSE("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name); } @@ -208,7 +208,7 @@ void TryLoadFonts(LocalisationService& localisationService) return; } - TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::Small)]; + TTFFontDescriptor smallFont = font->size[EnumValue(FontStyle::small)]; LOG_VERBOSE("Unable to load TrueType font '%s' -- trying the next font in the family.", smallFont.font_name); } diff --git a/src/openrct2/interface/WindowBase.cpp b/src/openrct2/interface/WindowBase.cpp index c2642acede..473dfdbf4d 100644 --- a/src/openrct2/interface/WindowBase.cpp +++ b/src/openrct2/interface/WindowBase.cpp @@ -93,7 +93,7 @@ namespace OpenRCT2 auto& closeButton = widgets[2]; if (closeButton.type == WidgetType::closeBox || closeButton.type == WidgetType::empty) { - bool translucent = colours[closeButton.colour].hasFlag(ColourFlag::translucent); + bool translucent = colours[closeButton.colour].flags.has(ColourFlag::translucent); repositionCloseButton(closeButton, width, translucent); } diff --git a/src/openrct2/interface/WindowBase.h b/src/openrct2/interface/WindowBase.h index 4ea067b3a8..40ca5aab6a 100644 --- a/src/openrct2/interface/WindowBase.h +++ b/src/openrct2/interface/WindowBase.h @@ -11,6 +11,7 @@ #include "../localisation/Formatter.h" #include "Colour.h" +#include "ColourWithFlags.h" #include "ScrollArea.h" #include "Window.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index d7a817f213..cdc55f28bd 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -244,6 +244,7 @@ + @@ -285,6 +286,7 @@ + @@ -862,6 +864,7 @@ + diff --git a/src/openrct2/localisation/Formatting.cpp b/src/openrct2/localisation/Formatting.cpp index db1948189a..12b239b075 100644 --- a/src/openrct2/localisation/Formatting.cpp +++ b/src/openrct2/localisation/Formatting.cpp @@ -419,7 +419,7 @@ namespace OpenRCT2 // Currency symbol auto symbol = currencyDesc->symbol_unicode; auto affix = currencyDesc->affix_unicode; - if (!FontSupportsString(symbol, FontStyle::Medium)) + if (!FontSupportsString(symbol, FontStyle::medium)) { symbol = currencyDesc->symbol_ascii; affix = currencyDesc->affix_ascii; diff --git a/src/openrct2/object/ClimateObject.cpp b/src/openrct2/object/ClimateObject.cpp index a241e0820c..7e9ff423a5 100644 --- a/src/openrct2/object/ClimateObject.cpp +++ b/src/openrct2/object/ClimateObject.cpp @@ -68,7 +68,7 @@ namespace OpenRCT2 ft.Add(dist[i] * 100 / totalSize); DrawTextEllipsised( rt, coords + ScreenCoordsXY{ 12, 22 }, 35, STR_CLIMATE_WEATHER_PERCENT, ft, - { FontStyle::Small, TextAlignment::CENTRE }); + { FontStyle::small, TextAlignment::centre }); } } diff --git a/src/openrct2/object/MusicObject.cpp b/src/openrct2/object/MusicObject.cpp index 263cdcb3e7..5d90c86cbf 100644 --- a/src/openrct2/object/MusicObject.cpp +++ b/src/openrct2/object/MusicObject.cpp @@ -94,7 +94,7 @@ namespace OpenRCT2 if (_hasPreview) GfxDrawSprite(rt, ImageId(_previewImageId), { 0, 0 }); else - DrawTextBasic(rt, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE }); + DrawTextBasic(rt, { x, y }, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::centre }); } bool MusicObject::HasPreview() const diff --git a/src/openrct2/object/WaterObject.cpp b/src/openrct2/object/WaterObject.cpp index dfe0998ac3..cd2cbcd4ee 100644 --- a/src/openrct2/object/WaterObject.cpp +++ b/src/openrct2/object/WaterObject.cpp @@ -60,7 +60,7 @@ namespace OpenRCT2 { // Write (no image) auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 }; - DrawTextBasic(rt, screenCoords, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::CENTRE }); + DrawTextBasic(rt, screenCoords, STR_WINDOW_NO_IMAGE, {}, { TextAlignment::centre }); } void WaterObject::ReadJson([[maybe_unused]] IReadObjectContext* context, json_t& root) diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 8c5fb8b63c..7301610af1 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -1098,6 +1098,6 @@ void PaintDrawMoneyStructs(RenderTarget& rt, PaintStringStruct* ps) GfxDrawStringWithYOffsets( rt, buffer, { COLOUR_BLACK }, ps->ScreenPos, reinterpret_cast(ps->y_offsets), forceSpriteFont, - FontStyle::Medium); + FontStyle::medium); } while ((ps = ps->NextEntry) != nullptr); } diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 6ab1efbc38..89c102172a 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -88,7 +88,7 @@ void Painter::PaintReplayNotice(RenderTarget& rt, const char* text) char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{OUTLINE}{RED}{STRING}", text); - auto stringWidth = GfxGetStringWidth(buffer, FontStyle::Medium); + auto stringWidth = GfxGetStringWidth(buffer, FontStyle::medium); screenCoords.x = screenCoords.x - stringWidth; if (((getGameState().currentTicks >> 1) & 0xF) > 4) @@ -116,7 +116,7 @@ void Painter::PaintFPS(RenderTarget& rt) char buffer[64]{}; FormatStringToBuffer(buffer, sizeof(buffer), "{OUTLINE}{WHITE}{INT32}", _currentFPS); - const int32_t stringWidth = GfxGetStringWidth(buffer, FontStyle::Medium); + const int32_t stringWidth = GfxGetStringWidth(buffer, FontStyle::medium); // Figure out where counter should be rendered ScreenCoordsXY screenCoords(_uiContext.GetWidth() / 2, 2); diff --git a/src/openrct2/paint/tile_element/Paint.Banner.cpp b/src/openrct2/paint/tile_element/Paint.Banner.cpp index 5a54a0a035..91550fa518 100644 --- a/src/openrct2/paint/tile_element/Paint.Banner.cpp +++ b/src/openrct2/paint/tile_element/Paint.Banner.cpp @@ -67,7 +67,7 @@ static void PaintBannerScrollingText( OpenRCT2::FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data()); } - auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny); auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK); PaintAddImageAsChild(session, imageId, { 0, 0, height + 22 }, { bbOffset, { 1, 1, 21 } }); diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index 2ffd312361..ca40e96212 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -75,7 +75,7 @@ static void PaintRideEntranceExitScrollingText( { FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data()); } - auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny); auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; PaintAddImageAsChild( @@ -257,7 +257,7 @@ static void PaintParkEntranceScrollingText( FormatStringLegacy(text, sizeof(text), STR_BANNER_TEXT_FORMAT, ft.Data()); } - auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny); auto scroll = stringWidth > 0 ? (gameState.currentTicks / 2) % stringWidth : 0; auto imageIndex = ScrollingTextSetup( session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode + direction / 2, COLOUR_BLACK); diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index a29cb8ab7d..42b535f6d5 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -327,7 +327,7 @@ static void PaintLargeSceneryScrollingText( } auto scrollMode = sceneryEntry.scrolling_mode + ((direction + 1) & 3); - auto stringWidth = GfxGetStringWidth(text, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(text, FontStyle::tiny); auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_SCROLLING_SIGN_TEXT, ft, scroll, scrollMode, textPaletteIndex); PaintAddImageAsChild(session, imageId, { 0, 0, height + 25 }, { bbOffset, { 1, 1, 21 } }); diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index 072200084d..d217b98153 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -175,7 +175,7 @@ static void PathPaintQueueBanner( FormatStringLegacy(bannerBuffer, sizeof(bannerBuffer), STR_BANNER_TEXT_FORMAT, ft.Data()); } - uint16_t stringWidth = GfxGetStringWidth(bannerBuffer, FontStyle::Tiny); + uint16_t stringWidth = GfxGetStringWidth(bannerBuffer, FontStyle::tiny); uint16_t scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; PaintAddImageAsChild( diff --git a/src/openrct2/paint/tile_element/Paint.Wall.cpp b/src/openrct2/paint/tile_element/Paint.Wall.cpp index a1fc5dd449..c9d96ddaad 100644 --- a/src/openrct2/paint/tile_element/Paint.Wall.cpp +++ b/src/openrct2/paint/tile_element/Paint.Wall.cpp @@ -184,7 +184,7 @@ static void PaintWallScrollingText( OpenRCT2::FormatStringLegacy(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, ft.Data()); } - auto stringWidth = GfxGetStringWidth(signString, FontStyle::Tiny); + auto stringWidth = GfxGetStringWidth(signString, FontStyle::tiny); auto scroll = stringWidth > 0 ? (getGameState().currentTicks / 2) % stringWidth : 0; auto imageId = ScrollingTextSetup(session, STR_SCROLLING_SIGN_TEXT, ft, scroll, scrollingMode, textPaletteIndex); PaintAddImageAsChild(session, imageId, { 0, 0, height + 8 }, { boundsOffset, { 1, 1, 13 } });