forked from rosebudai/OpenRCT2-Web
Merge pull request #25427 from Gymnasiast/refactor/string-drawing-2
Refactor string drawing
This commit is contained in:
102 files changed
+567
-488
No files matched your search
@@ -29,6 +29,7 @@
|
||||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/drawing/Drawing.String.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/drawing/IDrawingContext.h>
|
||||
#include <openrct2/drawing/IDrawingEngine.h>
|
||||
@@ -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<ivec4, 4> 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() };
|
||||
|
||||
@@ -20,8 +20,9 @@ struct ImageId;
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
struct ColourWithFlags;
|
||||
class Formatter;
|
||||
}
|
||||
} // namespace OpenRCT2
|
||||
|
||||
namespace OpenRCT2::Dropdown
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <openrct2-ui/interface/Graph.h>
|
||||
#include <openrct2/Date.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/localisation/Localisation.Date.h>
|
||||
@@ -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<StringId>(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);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/core/Money.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/world/Location.hpp>
|
||||
|
||||
namespace OpenRCT2::Graph
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/interface/Viewport.h>
|
||||
#include <openrct2/interface/Window.h>
|
||||
#include <openrct2/localisation/Language.h>
|
||||
@@ -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();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Language.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <stdexcept>
|
||||
@@ -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 };
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/interface/Window.h>
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
struct ColourWithFlags;
|
||||
}
|
||||
|
||||
namespace OpenRCT2::Ui
|
||||
{
|
||||
enum
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/drawing/Text.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
@@ -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<utf8*>(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<int32_t>(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);
|
||||
}
|
||||
|
||||
@@ -696,13 +696,13 @@ void CustomListView::PaintHeading(
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(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<StringId>(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<const char*>(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;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <openrct2/SpriteIds.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/interface/Window.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/scripting/Plugin.h>
|
||||
@@ -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_t>(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<utf8*>(desc.Text.c_str());
|
||||
widget.flags.set(WidgetFlag::textIsString);
|
||||
if (desc.TextAlign == TextAlignment::CENTRE)
|
||||
if (desc.TextAlign == TextAlignment::centre)
|
||||
{
|
||||
widget.type = WidgetType::labelCentred;
|
||||
}
|
||||
|
||||
@@ -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<ScreenSize>(_ctx, { width, height });
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "ScWidget.hpp"
|
||||
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/interface/Window.h>
|
||||
#include <openrct2/interface/WindowBase.h>
|
||||
#include <openrct2/scripting/Duktape.hpp>
|
||||
@@ -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_t>(colour, COLOUR_BLACK, COLOUR_COUNT - 1);
|
||||
c.flags = (isTranslucent ? EnumToFlag(ColourFlag::translucent) : 0);
|
||||
c.flags.set(ColourFlag::translucent, isTranslucent);
|
||||
}
|
||||
w->colours[i] = c;
|
||||
}
|
||||
|
||||
@@ -165,14 +165,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft.Add<StringId>(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<StringId>(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)
|
||||
|
||||
@@ -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<int32_t>(_changelogLines.size()) * FontGetLineHeight(FontStyle::Medium));
|
||||
static_cast<int32_t>(_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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ static StringId window_cheats_page_titles[] = {
|
||||
ft.Add<money64>(_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<int32_t>(_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<int32_t>(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<int32_t>(_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)
|
||||
{
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(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<money64>(_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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/core/Guard.hpp>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Language.h>
|
||||
#include <openrct2/localisation/LocalisationService.h>
|
||||
#include <openrct2/paint/Paint.h>
|
||||
@@ -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<int16_t>(strWidth, newWidth);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft.Add<money64>(_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 });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <openrct2/core/BitSet.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/localisation/Language.h>
|
||||
@@ -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);
|
||||
|
||||
@@ -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[] = {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/SpriteIds.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/interface/Cursors.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/management/Research.h>
|
||||
@@ -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>(stringId);
|
||||
}
|
||||
|
||||
DrawTextEllipsised(rt, screenPos, itemWidth, drawString, ft, { TextAlignment::CENTRE });
|
||||
DrawTextEllipsised(rt, screenPos, itemWidth, drawString, ft, { TextAlignment::centre });
|
||||
screenPos.y += 15;
|
||||
|
||||
// Item category
|
||||
|
||||
@@ -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<const char*>(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<const char*>(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<StringId>(STR_STRING);
|
||||
ft.Add<const char*>(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<PeepAnimationsObject*>(_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<const utf8*>(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<const char*>(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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<money64>(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<money64>(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 },
|
||||
|
||||
@@ -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<money64>(_windowFootpathCost);
|
||||
DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE });
|
||||
DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::centre });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <openrct2/entity/EntityRegistry.h>
|
||||
#include <openrct2/entity/Guest.h>
|
||||
#include <openrct2/entity/Staff.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Localisation.Date.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
@@ -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<money64>(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<uint32_t>(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<StringId>(DateDayNames[day]);
|
||||
ft.Add<int16_t>(month);
|
||||
ft.Add<int16_t>(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<int32_t>(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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<StringId>(STR_GUESTS_COUNT_COMMA_SEP);
|
||||
ft.Add<uint32_t>(group.NumGuests);
|
||||
DrawTextBasic(rt, { 326, y }, format, ft, { TextAlignment::RIGHT });
|
||||
DrawTextBasic(rt, { 326, y }, format, ft, { TextAlignment::right });
|
||||
}
|
||||
y += kSummarisedGuestsRowHeight;
|
||||
index++;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft.Add<uint16_t>(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<money64>(_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<money64>(_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<money64>(price);
|
||||
DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE });
|
||||
DrawTextBasic(rt, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::centre });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Localisation.Date.h>
|
||||
#include <openrct2/network/Network.h>
|
||||
@@ -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<const char*>(_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<StringId>(STR_STRING);
|
||||
ft.Add<char*>(_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<StringId>(STR_STRING);
|
||||
|
||||
@@ -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<int16_t>(textOffset + GfxGetStringWidth(labelStr, FontStyle::Medium)), minWidth);
|
||||
static_cast<int16_t>(textOffset + GfxGetStringWidth(labelStr, FontStyle::medium)), minWidth);
|
||||
}
|
||||
width = std::max(minWidth, width);
|
||||
_recalculateScrollbars = true;
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/drawing/Text.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/network/Network.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
@@ -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<const char*>(_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<const char*>(_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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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<money64>(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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<StringId>(DateDayNames[newsItem.day - 1]);
|
||||
ft.Add<StringId>(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<const char*>(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()))
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft.Add<char*>(_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 });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<StringId>(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)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft.Add<money64>(_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 });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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<StringId>(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<int16_t>(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<int32_t>(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<int32_t>(queueTime);
|
||||
screenCoords.y += DrawTextWrapped(rt, screenCoords, 308, stringId, ft, { TextAlignment::LEFT });
|
||||
screenCoords.y += DrawTextWrapped(rt, screenCoords, 308, stringId, ft, { TextAlignment::left });
|
||||
screenCoords.y += 5;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<money64>(_currentTrackPrice);
|
||||
DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE });
|
||||
DrawTextBasic(rt, screenCoords, STR_COST_LABEL, ft, { TextAlignment::centre });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <openrct2/core/FileStream.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/localisation/LocalisationService.h>
|
||||
@@ -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<StringId>(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<utf8*>(shortPath.c_str());
|
||||
@@ -374,7 +375,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft.Add<const char*>(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<StringId>(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<const char*>(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<const char*>(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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(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 });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft.Add<StringId>(STR_STRING);
|
||||
ft.Add<const char*>(_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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -208,13 +208,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(_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();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <openrct2/SpriteIds.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/drawing/Text.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
@@ -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)
|
||||
|
||||
@@ -1060,12 +1060,12 @@ static uint64_t PageDisabledWidgets[] = {
|
||||
ft.Add<int32_t>(tileCoords.x);
|
||||
DrawTextBasic(
|
||||
rt, screenCoords + ScreenCoordsXY{ 43, yOffset }, STR_FORMAT_INTEGER, ft,
|
||||
{ colours[1], TextAlignment::RIGHT });
|
||||
{ colours[1], TextAlignment::right });
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(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;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <openrct2/SpriteIds.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <openrct2/SpriteIds.h>
|
||||
#include <openrct2/actions/LoadOrQuitAction.h>
|
||||
#include <openrct2/drawing/Rectangle.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <openrct2/Version.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
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<int16_t>(width, GfxGetStringWidth(platformInfo, FontStyle::Medium)) + kTextOffset;
|
||||
width = std::max<int16_t>(width, GfxGetStringWidth(platformInfo, FontStyle::medium)) + kTextOffset;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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<const char*>(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;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/entity/Staff.h>
|
||||
#include <openrct2/interface/Chat.h>
|
||||
#include <openrct2/interface/ColourWithFlags.h>
|
||||
#include <openrct2/interface/Screenshot.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/network/Network.h>
|
||||
@@ -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<int32_t>(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)
|
||||
|
||||
@@ -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<const utf8*>(_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 });
|
||||
}
|
||||
};
|
||||
/**
|
||||
|
||||
@@ -376,7 +376,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
ft = Formatter();
|
||||
ft.Add<money64>(_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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<utf8*>(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<const utf8*>(_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 };
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(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<money64>(_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<money64>(_waterToolLowerCost);
|
||||
DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE });
|
||||
DrawTextBasic(rt, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::centre });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,22 @@ struct FlagHolder
|
||||
holder |= EnumsToFlags(types...);
|
||||
}
|
||||
|
||||
template<typename... TTypes>
|
||||
constexpr FlagHolder with(TTypes... types)
|
||||
{
|
||||
FlagHolder res = *this;
|
||||
res.set(types...);
|
||||
return res;
|
||||
}
|
||||
|
||||
template<typename... TTypes>
|
||||
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.
|
||||
|
||||
@@ -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<uint8_t*>(&info->palette));
|
||||
}
|
||||
ColourCharacterWindow(
|
||||
colour.colour, info->colourFlags.has(ColourFlag::withOutline), reinterpret_cast<uint8_t*>(&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));
|
||||
|
||||
@@ -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 <cstdint>
|
||||
|
||||
enum class FontStyle : uint8_t;
|
||||
enum class TextDarkness : uint8_t;
|
||||
|
||||
enum class TextDrawFlag : uint8_t
|
||||
{
|
||||
noFormatting,
|
||||
yOffsetEffect,
|
||||
ttf,
|
||||
noDraw,
|
||||
};
|
||||
using TextDrawFlags = FlagHolder<uint8_t, TextDrawFlag>;
|
||||
|
||||
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{};
|
||||
};
|
||||
@@ -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());
|
||||
}
|
||||
@@ -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!
|
||||
|
||||
@@ -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<FontStyle, FontStyleCount> FontStyles = { FontStyle::Small, FontStyle::Medium, FontStyle::Tiny };
|
||||
constexpr std::array<FontStyle, FontStyleCount> FontStyles = { FontStyle::small, FontStyle::medium, FontStyle::tiny };
|
||||
|
||||
#ifndef DISABLE_TTF
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "Drawing.h"
|
||||
#include "TTF.h"
|
||||
|
||||
struct TextDrawInfo;
|
||||
|
||||
namespace OpenRCT2::Drawing
|
||||
{
|
||||
struct IDrawingEngine;
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -11,11 +11,15 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
struct ColourWithFlags;
|
||||
enum class FilterPaletteID : int32_t;
|
||||
struct RenderTarget;
|
||||
struct ScreenRect;
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
struct ColourWithFlags;
|
||||
}
|
||||
|
||||
namespace OpenRCT2::Drawing::Rectangle
|
||||
{
|
||||
enum class BorderStyle : uint8_t
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
+16
-13
@@ -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)
|
||||
|
||||
@@ -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<false>(rt, bgColor, surface, x + 1, y, 0);
|
||||
DrawTTFBitmapInternal<false>(rt, bgColor, surface, x - 1, y, 0);
|
||||
DrawTTFBitmapInternal<false>(rt, bgColor, surface, x, y + 1, 0);
|
||||
DrawTTFBitmapInternal<false>(rt, bgColor, surface, x, y - 1, 0);
|
||||
}
|
||||
if (info->flags & TEXT_DRAW_FLAG_INSET)
|
||||
if (info->colourFlags.has(ColourFlag::inset))
|
||||
{
|
||||
DrawTTFBitmapInternal<false>(rt, bgColor, surface, x + 1, y + 1, 0);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
struct TextDrawInfo;
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
namespace Ui
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -14,6 +14,11 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
@@ -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 <cstdint>
|
||||
|
||||
using colour_t = uint8_t;
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
constexpr uint8_t kLegacyColourFlagTranslucent = (1 << 7);
|
||||
|
||||
enum class ColourFlag : uint8_t
|
||||
{
|
||||
translucent,
|
||||
inset,
|
||||
withOutline,
|
||||
};
|
||||
using ColourFlags = FlagHolder<uint8_t, ColourFlag>;
|
||||
|
||||
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
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "../localisation/Formatter.h"
|
||||
#include "Colour.h"
|
||||
#include "ColourWithFlags.h"
|
||||
#include "ScrollArea.h"
|
||||
#include "Window.h"
|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@
|
||||
<ClInclude Include="Diagnostic.h" />
|
||||
<ClInclude Include="drawing\ColourPalette.h" />
|
||||
<ClInclude Include="drawing\Drawing.h" />
|
||||
<ClInclude Include="drawing\Drawing.String.h" />
|
||||
<ClInclude Include="drawing\Font.h" />
|
||||
<ClInclude Include="drawing\IDrawingContext.h" />
|
||||
<ClInclude Include="drawing\IDrawingEngine.h" />
|
||||
@@ -285,6 +286,7 @@
|
||||
<ClInclude Include="Input.h" />
|
||||
<ClInclude Include="interface\Chat.h" />
|
||||
<ClInclude Include="interface\Colour.h" />
|
||||
<ClInclude Include="interface\ColourWithFlags.h" />
|
||||
<ClInclude Include="interface\Cursors.h" />
|
||||
<ClInclude Include="interface\FontFamilies.h" />
|
||||
<ClInclude Include="interface\Fonts.h" />
|
||||
@@ -862,6 +864,7 @@
|
||||
<ClCompile Include="Input.cpp" />
|
||||
<ClCompile Include="interface\Chat.cpp" />
|
||||
<ClCompile Include="interface\Colour.cpp" />
|
||||
<ClCompile Include="interface\ColourWithFlags.cpp" />
|
||||
<ClCompile Include="interface\Cursors.cpp" />
|
||||
<ClCompile Include="interface\FontFamilies.cpp" />
|
||||
<ClCompile Include="interface\Fonts.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;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRCT2
|
||||
ft.Add<uint16_t>(dist[i] * 100 / totalSize);
|
||||
DrawTextEllipsised(
|
||||
rt, coords + ScreenCoordsXY{ 12, 22 }, 35, STR_CLIMATE_WEATHER_PERCENT, ft,
|
||||
{ FontStyle::Small, TextAlignment::CENTRE });
|
||||
{ FontStyle::small, TextAlignment::centre });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1098,6 +1098,6 @@ void PaintDrawMoneyStructs(RenderTarget& rt, PaintStringStruct* ps)
|
||||
|
||||
GfxDrawStringWithYOffsets(
|
||||
rt, buffer, { COLOUR_BLACK }, ps->ScreenPos, reinterpret_cast<int8_t*>(ps->y_offsets), forceSpriteFont,
|
||||
FontStyle::Medium);
|
||||
FontStyle::medium);
|
||||
} while ((ps = ps->NextEntry) != nullptr);
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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 } });
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 } });
|
||||
|
||||
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user