You've already forked OpenRCT2-Unity
mirror of
https://github.com/izzy2lost/OpenRCT2-Unity.git
synced 2026-03-10 12:38:22 -07:00
Merge pull request #14189 from Gymnasiast/refactor/draw-text
Refactor text drawing
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Graph
|
||||
// Draw month text
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint32_t>(DateGameShortMonthNames[date_get_month((yearOver32 / 4) + MONTH_COUNT)]);
|
||||
gfx_draw_string_centred(dpi, STR_GRAPH_LABEL, screenCoords - ScreenCoordsXY{ 0, 10 }, COLOUR_BLACK, ft.Data());
|
||||
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 10 }, STR_GRAPH_LABEL, ft, { TextAlignment::CENTRE });
|
||||
|
||||
// Draw month mark
|
||||
gfx_fill_rect(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_10);
|
||||
@@ -170,8 +170,8 @@ namespace Graph
|
||||
{
|
||||
// Draw month text
|
||||
int32_t monthFormat = DateGameShortMonthNames[date_get_month((yearOver32 / 4) + MONTH_COUNT)];
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_GRAPH_LABEL, screenCoords - ScreenCoordsXY{ 0, 10 }, COLOUR_BLACK, &monthFormat);
|
||||
DrawTextBasic(
|
||||
dpi, screenCoords - ScreenCoordsXY{ 0, 10 }, STR_GRAPH_LABEL, &monthFormat, { TextAlignment::CENTRE });
|
||||
|
||||
// Draw month mark
|
||||
gfx_fill_rect(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ 0, 3 } }, PALETTE_INDEX_10);
|
||||
@@ -273,8 +273,9 @@ namespace Graph
|
||||
gfx_draw_dashed_line(dpi, { info.coords, { info.coords.x, cursorPosition.y } }, DefaultDashedLength, 0);
|
||||
}
|
||||
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_FINANCES_SUMMARY_EXPENDITURE_VALUE, info.coords - ScreenCoordsXY{ 0, 16 }, COLOUR_BLACK, &info.money);
|
||||
DrawTextBasic(
|
||||
dpi, info.coords - ScreenCoordsXY{ 0, 16 }, STR_FINANCES_SUMMARY_EXPENDITURE_VALUE, &info.money,
|
||||
{ TextAlignment::CENTRE });
|
||||
|
||||
gfx_fill_rect(
|
||||
dpi, { { info.coords - ScreenCoordsXY{ 2, 2 } }, info.coords + ScreenCoordsXY{ 2, 2 } }, PALETTE_INDEX_10);
|
||||
|
||||
@@ -26,10 +26,14 @@ using namespace OpenRCT2::Ui;
|
||||
|
||||
static InGameConsole _inGameConsole;
|
||||
|
||||
static FontSpriteBase InGameConsoleGetFontSpriteBase()
|
||||
{
|
||||
return (gConfigInterface.console_small_font ? FontSpriteBase::SMALL : FontSpriteBase::MEDIUM);
|
||||
}
|
||||
|
||||
static int32_t InGameConsoleGetLineHeight()
|
||||
{
|
||||
auto fontSpriteBase = (gConfigInterface.console_small_font ? FONT_SPRITE_BASE_SMALL : FONT_SPRITE_BASE_MEDIUM);
|
||||
return font_get_line_height(fontSpriteBase);
|
||||
return font_get_line_height(InGameConsoleGetFontSpriteBase());
|
||||
}
|
||||
|
||||
InGameConsole::InGameConsole()
|
||||
@@ -146,7 +150,7 @@ void InGameConsole::RefreshCaret(size_t position)
|
||||
_selectionStart = position;
|
||||
char tempString[TEXT_INPUT_SIZE] = { 0 };
|
||||
std::memcpy(tempString, &_consoleCurrentLine, _selectionStart);
|
||||
_caretScreenPosX = gfx_get_string_width_no_formatting(tempString);
|
||||
_caretScreenPosX = gfx_get_string_width_no_formatting(tempString, InGameConsoleGetFontSpriteBase());
|
||||
}
|
||||
|
||||
void InGameConsole::Scroll(int32_t linesToScroll)
|
||||
@@ -272,7 +276,6 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const
|
||||
return;
|
||||
|
||||
// Set font
|
||||
gCurrentFontSpriteBase = (gConfigInterface.console_small_font ? FONT_SPRITE_BASE_SMALL : FONT_SPRITE_BASE_MEDIUM);
|
||||
uint8_t textColour = NOT_TRANSLUCENT(ThemeGetColour(WC_CONSOLE, 1));
|
||||
const int32_t lineHeight = InGameConsoleGetLineHeight();
|
||||
const int32_t maxLines = GetNumVisibleLines();
|
||||
@@ -318,7 +321,7 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const
|
||||
{
|
||||
const size_t index = i + _consoleScrollPos;
|
||||
lineBuffer = colourFormatStr + _consoleLines[index];
|
||||
gfx_draw_string(dpi, lineBuffer.c_str(), textColour, screenCoords);
|
||||
gfx_draw_string(dpi, screenCoords, lineBuffer.c_str(), { textColour, InGameConsoleGetFontSpriteBase() });
|
||||
screenCoords.y += lineHeight;
|
||||
}
|
||||
|
||||
@@ -326,7 +329,7 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const
|
||||
|
||||
// Draw current line
|
||||
lineBuffer = colourFormatStr + _consoleCurrentLine;
|
||||
gfx_draw_string_no_formatting(dpi, lineBuffer.c_str(), TEXT_COLOUR_255, screenCoords);
|
||||
gfx_draw_string_no_formatting(dpi, screenCoords, lineBuffer.c_str(), { TEXT_COLOUR_255, InGameConsoleGetFontSpriteBase() });
|
||||
|
||||
// Draw caret
|
||||
if (_consoleCaretTicks < CONSOLE_CARET_FLASH_THRESHOLD)
|
||||
|
||||
@@ -333,7 +333,7 @@ static void WidgetTextCentred(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
||||
return;
|
||||
|
||||
// Get the colour
|
||||
uint8_t colour = w->colours[widget->colour];
|
||||
colour_t colour = w->colours[widget->colour];
|
||||
colour &= ~(COLOUR_FLAG_TRANSLUCENT);
|
||||
if (WidgetIsDisabled(w, widgetIndex))
|
||||
colour |= COLOUR_FLAG_INSET;
|
||||
@@ -358,11 +358,11 @@ static void WidgetTextCentred(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
||||
ScreenCoordsXY coords = { (topLeft.x + r + 1) / 2 - 1, topLeft.y };
|
||||
if (widget->type == WindowWidgetType::LabelCentred)
|
||||
{
|
||||
gfx_draw_string_centred_wrapped(dpi, ft.Data(), coords, widget->width() - 2, stringId, colour);
|
||||
DrawTextWrapped(dpi, coords, widget->width() - 2, stringId, ft, { colour, TextAlignment::CENTRE });
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTextEllipsised(dpi, coords, widget->width() - 2, stringId, ft, colour, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, coords, widget->width() - 2, stringId, ft, { colour, TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ static void WidgetText(rct_drawpixelinfo* dpi, rct_window* w, rct_widgetindex wi
|
||||
ScreenCoordsXY coords = { l + 1, t };
|
||||
if (widget->type == WindowWidgetType::LabelCentred)
|
||||
{
|
||||
gfx_draw_string_centred_wrapped(dpi, ft.Data(), coords, r - l, stringId, colour);
|
||||
DrawTextWrapped(dpi, coords, r - l, stringId, ft, { colour, TextAlignment::CENTRE });
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -483,8 +483,8 @@ static void WidgetGroupboxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widget
|
||||
format_string(buffer, sizeof(buffer), stringId, formatArgs);
|
||||
auto ft = Formatter();
|
||||
ft.Add<utf8*>(buffer);
|
||||
gfx_draw_string_left(dpi, STR_STRING, ft.Data(), colour, { l, t });
|
||||
textRight = l + gfx_get_string_width(buffer) + 1;
|
||||
DrawTextBasic(dpi, { l, t }, STR_STRING, ft, { colour });
|
||||
textRight = l + gfx_get_string_width(buffer, FontSpriteBase::MEDIUM) + 1;
|
||||
}
|
||||
|
||||
// Border
|
||||
@@ -563,7 +563,7 @@ static void WidgetCaptionDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
||||
}
|
||||
topLeft.x += width / 2;
|
||||
DrawTextEllipsised(
|
||||
dpi, topLeft, width, widget->text, Formatter::Common(), COLOUR_WHITE | COLOUR_FLAG_OUTLINE, TextAlignment::CENTRE);
|
||||
dpi, topLeft, width, widget->text, Formatter::Common(), { COLOUR_WHITE | COLOUR_FLAG_OUTLINE, TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -600,7 +600,7 @@ static void WidgetCloseboxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widget
|
||||
if (WidgetIsDisabled(w, widgetIndex))
|
||||
colour |= COLOUR_FLAG_INSET;
|
||||
|
||||
DrawTextEllipsised(dpi, topLeft, widget->width() - 2, widget->text, Formatter::Common(), colour, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, topLeft, widget->width() - 2, widget->text, Formatter::Common(), { colour, TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -618,7 +618,7 @@ static void WidgetCheckboxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widget
|
||||
ScreenCoordsXY midLeft = { topLeft.x, (topLeft.y + bottomRight.y) / 2 };
|
||||
|
||||
// Get the colour
|
||||
uint8_t colour = w->colours[widget->colour];
|
||||
colour_t colour = w->colours[widget->colour];
|
||||
|
||||
// checkbox
|
||||
gfx_fill_rect_inset(dpi, { midLeft - ScreenCoordsXY{ 0, 5 }, midLeft + ScreenCoordsXY{ 9, 4 } }, colour, INSET_RECT_F_60);
|
||||
@@ -631,9 +631,9 @@ static void WidgetCheckboxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widget
|
||||
// fill it when checkbox is pressed
|
||||
if (WidgetIsPressed(w, widgetIndex))
|
||||
{
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
gfx_draw_string(
|
||||
dpi, static_cast<const char*>(CheckBoxMarkString), NOT_TRANSLUCENT(colour), { midLeft - ScreenCoordsXY{ 0, 5 } });
|
||||
dpi, { midLeft - ScreenCoordsXY{ 0, 5 } }, static_cast<const char*>(CheckBoxMarkString),
|
||||
{ static_cast<colour_t>(NOT_TRANSLUCENT(colour)) });
|
||||
}
|
||||
|
||||
// draw the text
|
||||
@@ -671,8 +671,6 @@ static void WidgetScrollDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgetin
|
||||
bottomRight.x--;
|
||||
bottomRight.y--;
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
||||
// Horizontal scrollbar
|
||||
if (scroll->flags & HSCROLLBAR_VISIBLE)
|
||||
WidgetHScrollbarDraw(
|
||||
@@ -735,7 +733,7 @@ static void WidgetHScrollbarDraw(
|
||||
uint8_t flags = (scroll->flags & HSCROLLBAR_LEFT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0;
|
||||
|
||||
gfx_fill_rect_inset(dpi, { { l, t }, { l + (SCROLLBAR_WIDTH - 1), b } }, colour, flags);
|
||||
gfx_draw_string(dpi, static_cast<const char*>(BlackLeftArrowString), COLOUR_BLACK, { l + 1, t });
|
||||
gfx_draw_string(dpi, { l + 1, t }, static_cast<const char*>(BlackLeftArrowString), {});
|
||||
}
|
||||
|
||||
// Thumb
|
||||
@@ -752,7 +750,7 @@ static void WidgetHScrollbarDraw(
|
||||
uint8_t flags = (scroll->flags & HSCROLLBAR_RIGHT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0;
|
||||
|
||||
gfx_fill_rect_inset(dpi, { { r - (SCROLLBAR_WIDTH - 1), t }, { r, b } }, colour, flags);
|
||||
gfx_draw_string(dpi, static_cast<const char*>(BlackRightArrowString), COLOUR_BLACK, { r - 6, t });
|
||||
gfx_draw_string(dpi, { r - 6, t }, static_cast<const char*>(BlackRightArrowString), {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,7 +770,7 @@ static void WidgetVScrollbarDraw(
|
||||
gfx_fill_rect_inset(
|
||||
dpi, { { l, t }, { r, t + (SCROLLBAR_WIDTH - 1) } }, colour,
|
||||
((scroll->flags & VSCROLLBAR_UP_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_draw_string(dpi, static_cast<const char*>(BlackUpArrowString), COLOUR_BLACK, { l + 1, t - 1 });
|
||||
gfx_draw_string(dpi, { l + 1, t - 1 }, static_cast<const char*>(BlackUpArrowString), {});
|
||||
|
||||
// Thumb
|
||||
gfx_fill_rect_inset(
|
||||
@@ -785,7 +783,7 @@ static void WidgetVScrollbarDraw(
|
||||
gfx_fill_rect_inset(
|
||||
dpi, { { l, b - (SCROLLBAR_WIDTH - 1) }, { r, b } }, colour,
|
||||
((scroll->flags & VSCROLLBAR_DOWN_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_draw_string(dpi, static_cast<const char*>(BlackDownArrowString), COLOUR_BLACK, { l + 1, b - (SCROLLBAR_WIDTH - 1) });
|
||||
gfx_draw_string(dpi, { l + 1, b - (SCROLLBAR_WIDTH - 1) }, static_cast<const char*>(BlackDownArrowString), {});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1087,7 +1085,6 @@ void WidgetSetCheckboxValue(rct_window* w, rct_widgetindex widgetIndex, int32_t
|
||||
static void WidgetTextBoxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
int32_t no_lines = 0;
|
||||
int32_t font_height = 0;
|
||||
char wrapped_string[TEXT_INPUT_SIZE];
|
||||
|
||||
// Get the widget
|
||||
@@ -1106,8 +1103,6 @@ static void WidgetTextBoxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
||||
// gfx_fill_rect_inset(dpi, l, t, r, b, colour, 0x20 | (!active ? 0x40 : 0x00));
|
||||
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, colour, INSET_RECT_F_60);
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
||||
// Figure out where the text should be positioned vertically.
|
||||
topLeft.y = w->windowPos.y + widget->textTop();
|
||||
|
||||
@@ -1116,8 +1111,9 @@ static void WidgetTextBoxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
||||
if (w->widgets[widgetIndex].text != 0)
|
||||
{
|
||||
safe_strcpy(wrapped_string, w->widgets[widgetIndex].string, 512);
|
||||
gfx_wrap_string(wrapped_string, bottomRight.x - topLeft.x - 5, &no_lines, &font_height);
|
||||
gfx_draw_string_no_formatting(dpi, wrapped_string, w->colours[1], { topLeft.x + 2, topLeft.y });
|
||||
gfx_wrap_string(wrapped_string, bottomRight.x - topLeft.x - 5, FontSpriteBase::MEDIUM, &no_lines);
|
||||
gfx_draw_string_no_formatting(
|
||||
dpi, { topLeft.x + 2, topLeft.y }, wrapped_string, { w->colours[1], FontSpriteBase::MEDIUM });
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1126,16 +1122,16 @@ static void WidgetTextBoxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
||||
|
||||
// String length needs to add 12 either side of box
|
||||
// +13 for cursor when max length.
|
||||
gfx_wrap_string(wrapped_string, bottomRight.x - topLeft.x - 5 - 6, &no_lines, &font_height);
|
||||
gfx_wrap_string(wrapped_string, bottomRight.x - topLeft.x - 5 - 6, FontSpriteBase::MEDIUM, &no_lines);
|
||||
|
||||
gfx_draw_string_no_formatting(dpi, wrapped_string, w->colours[1], { topLeft.x + 2, topLeft.y });
|
||||
gfx_draw_string_no_formatting(dpi, { topLeft.x + 2, topLeft.y }, wrapped_string, { w->colours[1], FontSpriteBase::MEDIUM });
|
||||
|
||||
size_t string_length = get_string_size(wrapped_string) - 1;
|
||||
|
||||
// Make a copy of the string for measuring the width.
|
||||
char temp_string[TEXT_INPUT_SIZE] = { 0 };
|
||||
std::memcpy(temp_string, wrapped_string, std::min(string_length, gTextInput->SelectionStart));
|
||||
int32_t cur_x = topLeft.x + gfx_get_string_width_no_formatting(temp_string) + 3;
|
||||
int32_t cur_x = topLeft.x + gfx_get_string_width_no_formatting(temp_string, FontSpriteBase::MEDIUM) + 3;
|
||||
|
||||
int32_t width = 6;
|
||||
if (static_cast<uint32_t>(gTextInput->SelectionStart) < strlen(gTextBoxInput))
|
||||
@@ -1144,7 +1140,7 @@ static void WidgetTextBoxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
||||
// of the character that the cursor is under.
|
||||
temp_string[1] = '\0';
|
||||
temp_string[0] = gTextBoxInput[gTextInput->SelectionStart];
|
||||
width = std::max(gfx_get_string_width_no_formatting(temp_string) - 2, 4);
|
||||
width = std::max(gfx_get_string_width_no_formatting(temp_string, FontSpriteBase::MEDIUM) - 2, 4);
|
||||
}
|
||||
|
||||
if (gTextBoxFrameNo <= 15)
|
||||
|
||||
@@ -681,13 +681,13 @@ void CustomListView::PaintHeading(
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_UP);
|
||||
DrawTextBasic(dpi, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, COLOUR_BLACK, TextAlignment::RIGHT);
|
||||
DrawTextBasic(dpi, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT });
|
||||
}
|
||||
else if (sortOrder == ColumnSortOrder::Descending)
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_DOWN);
|
||||
DrawTextBasic(dpi, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, COLOUR_BLACK, TextAlignment::RIGHT);
|
||||
DrawTextBasic(dpi, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -710,11 +710,11 @@ void CustomListView::PaintSeperator(
|
||||
// Draw string
|
||||
Formatter ft;
|
||||
ft.Add<const char*>(text);
|
||||
gfx_draw_string_centred(dpi, STR_STRING, { centreX, pos.y }, baseColour, ft.Data());
|
||||
DrawTextBasic(dpi, { centreX, pos.y }, STR_STRING, ft.Data(), { baseColour, TextAlignment::CENTRE });
|
||||
|
||||
// Get string dimensions
|
||||
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_STRING, ft.Data());
|
||||
int32_t categoryStringHalfWidth = (gfx_get_string_width(gCommonStringFormatBuffer) / 2) + 4;
|
||||
int32_t categoryStringHalfWidth = (gfx_get_string_width(gCommonStringFormatBuffer, FontSpriteBase::MEDIUM) / 2) + 4;
|
||||
int32_t strLeft = centreX - categoryStringHalfWidth;
|
||||
int32_t strRight = centreX + categoryStringHalfWidth;
|
||||
|
||||
@@ -758,7 +758,7 @@ void CustomListView::PaintCell(
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(text);
|
||||
DrawTextEllipsised(dpi, pos, size.width, stringId, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, pos, size.width, stringId, ft, {});
|
||||
}
|
||||
|
||||
std::optional<RowColumn> CustomListView::GetItemIndexAt(const ScreenCoordsXY& pos)
|
||||
|
||||
@@ -179,9 +179,8 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
DukValue measureText(const std::string& text)
|
||||
{
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
auto width = gfx_get_string_width(text);
|
||||
auto height = string_get_height_raw(text.c_str());
|
||||
auto width = gfx_get_string_width(text, FontSpriteBase::MEDIUM);
|
||||
auto height = string_get_height_raw(text.c_str(), FontSpriteBase::MEDIUM);
|
||||
return ToDuk<ScreenSize>(_ctx, { width, height });
|
||||
}
|
||||
|
||||
@@ -258,8 +257,7 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
void text(const std::string& text, int32_t x, int32_t y)
|
||||
{
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
gfx_draw_string(&_dpi, text.c_str(), _colour.value_or(0), { x, y });
|
||||
gfx_draw_string(&_dpi, { x, y }, text.c_str(), { _colour.value_or(0) });
|
||||
}
|
||||
};
|
||||
} // namespace OpenRCT2::Scripting
|
||||
|
||||
@@ -174,13 +174,14 @@ static void window_about_openrct2_common_paint(rct_window* w, rct_drawpixelinfo*
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_TITLE_SEQUENCE_OPENRCT2);
|
||||
gfx_draw_string_centred_wrapped(
|
||||
dpi, ft.Data(), aboutOpenRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, COLOUR_AQUAMARINE);
|
||||
DrawTextWrapped(
|
||||
dpi, aboutOpenRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::CENTRE });
|
||||
}
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_TITLE_SEQUENCE_RCT2);
|
||||
gfx_draw_string_centred_wrapped(dpi, ft.Data(), aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, COLOUR_AQUAMARINE);
|
||||
DrawTextWrapped(
|
||||
dpi, aboutRCT2Coords, 87, STR_WINDOW_COLOUR_2_STRINGID, ft, { COLOUR_AQUAMARINE, TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,14 +189,14 @@ static void window_about_openrct2_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
window_about_openrct2_common_paint(w, dpi);
|
||||
|
||||
int32_t lineHeight = font_get_line_height(FONT_SPRITE_BASE_MEDIUM);
|
||||
int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
||||
ScreenCoordsXY aboutCoords(
|
||||
w->windowPos.x + (w->width / 2), w->windowPos.y + w->widgets[WIDX_PAGE_BACKGROUND].top + lineHeight);
|
||||
int32_t width = w->width - 20;
|
||||
|
||||
aboutCoords.y += gfx_draw_string_centred_wrapped(
|
||||
dpi, nullptr, aboutCoords, width, STR_ABOUT_OPENRCT2_DESCRIPTION, w->colours[2])
|
||||
aboutCoords.y += DrawTextWrapped(
|
||||
dpi, aboutCoords, width, STR_ABOUT_OPENRCT2_DESCRIPTION, {}, { w->colours[2], TextAlignment::CENTRE })
|
||||
+ lineHeight;
|
||||
|
||||
rct_size16 logoSize = gfx_get_sprite_size(SPR_G2_LOGO);
|
||||
@@ -203,24 +204,28 @@ static void window_about_openrct2_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
aboutCoords.y += logoSize.height + lineHeight * 2;
|
||||
|
||||
// About OpenRCT2 text
|
||||
aboutCoords.y += gfx_draw_string_centred_wrapped(
|
||||
dpi, nullptr, aboutCoords, width, STR_ABOUT_OPENRCT2_DESCRIPTION_2, w->colours[2])
|
||||
aboutCoords.y += DrawTextWrapped(
|
||||
dpi, aboutCoords, width, STR_ABOUT_OPENRCT2_DESCRIPTION_2, {},
|
||||
{ w->colours[2], TextAlignment::CENTRE })
|
||||
+ lineHeight + 5;
|
||||
|
||||
// Copyright disclaimer; hidden when using truetype fonts to prevent
|
||||
// the text from overlapping the changelog button.
|
||||
if (!LocalisationService_UseTrueTypeFont())
|
||||
{
|
||||
gfx_draw_string_centred_wrapped(dpi, nullptr, aboutCoords, width, STR_ABOUT_OPENRCT2_DESCRIPTION_3, w->colours[2]);
|
||||
DrawTextWrapped(
|
||||
dpi, aboutCoords, width, STR_ABOUT_OPENRCT2_DESCRIPTION_3, {}, { w->colours[2], TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
// Version info
|
||||
utf8 buffer[256];
|
||||
utf8* ch = buffer;
|
||||
openrct2_write_full_version_info(ch, sizeof(buffer) - (ch - buffer));
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(buffer);
|
||||
|
||||
aboutCoords.y = w->windowPos.y + WH - 25;
|
||||
gfx_draw_string_centred_wrapped(dpi, &ch, aboutCoords, width, STR_STRING, w->colours[2]);
|
||||
DrawTextWrapped(dpi, aboutCoords, width, STR_STRING, ft, { w->colours[2], TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
static void window_about_openrct2_invalidate(rct_window* w)
|
||||
@@ -270,26 +275,26 @@ static void window_about_rct2_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
auto screenCoords = ScreenCoordsXY{ w->windowPos.x + 200, yPage + 5 };
|
||||
|
||||
int32_t lineHeight = font_get_line_height(FONT_SPRITE_BASE_MEDIUM);
|
||||
int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
||||
// Credits
|
||||
gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_COPYRIGHT_CS, {}, { TextAlignment::CENTRE });
|
||||
screenCoords.y += lineHeight + 74;
|
||||
gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_DESIGNED_AND_PROGRAMMED_BY_CS, {}, { TextAlignment::CENTRE });
|
||||
screenCoords.y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_GRAPHICS_BY_SF, {}, { TextAlignment::CENTRE });
|
||||
screenCoords.y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_SOUND_AND_MUSIC_BY_AB, {}, { TextAlignment::CENTRE });
|
||||
screenCoords.y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, {}, { TextAlignment::CENTRE });
|
||||
screenCoords.y += lineHeight + 3;
|
||||
gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_REPRESENTATION_BY_JL, {}, { TextAlignment::CENTRE });
|
||||
screenCoords.y += 2 * lineHeight + 5;
|
||||
gfx_draw_string_centred(dpi, STR_THANKS_TO, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_THANKS_TO, {}, { TextAlignment::CENTRE });
|
||||
screenCoords.y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_THANKS_TO_PEOPLE, {}, { TextAlignment::CENTRE });
|
||||
screenCoords.y += 2 * lineHeight + 5;
|
||||
gfx_draw_string_centred(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, screenCoords, COLOUR_BLACK, nullptr);
|
||||
DrawTextBasic(dpi, screenCoords, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, {}, { TextAlignment::CENTRE });
|
||||
|
||||
// Images
|
||||
gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, { w->windowPos.x + 92, yPage + 24 }, 0);
|
||||
|
||||
@@ -187,7 +187,7 @@ static void window_changelog_scrollgetsize(
|
||||
{
|
||||
*width = _changelogLongestLineWidth + 4;
|
||||
|
||||
const int32_t lineHeight = font_get_line_height(FONT_SPRITE_BASE_MEDIUM);
|
||||
const int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
*height = static_cast<int32_t>(_changelogLines.size() * lineHeight);
|
||||
}
|
||||
|
||||
@@ -213,9 +213,7 @@ static void window_changelog_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
static void window_changelog_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, [[maybe_unused]] int32_t scrollIndex)
|
||||
{
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
||||
const int32_t lineHeight = font_get_line_height(FONT_SPRITE_BASE_MEDIUM);
|
||||
const int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
||||
ScreenCoordsXY screenCoords(3, 3 - lineHeight);
|
||||
for (const auto& line : _changelogLines)
|
||||
@@ -224,7 +222,7 @@ static void window_changelog_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
||||
if (screenCoords.y + lineHeight < dpi->y || screenCoords.y >= dpi->y + dpi->height)
|
||||
continue;
|
||||
|
||||
gfx_draw_string(dpi, line.c_str(), w->colours[0], screenCoords);
|
||||
gfx_draw_string(dpi, screenCoords, line.c_str(), { w->colours[0] });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,11 +239,10 @@ static void window_changelog_process_changelog_text(const std::string& text)
|
||||
// To get the last substring (or only, if delimiter is not found)
|
||||
_changelogLines.push_back(text.substr(prev));
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
_changelogLongestLineWidth = 0;
|
||||
for (const auto& line : _changelogLines)
|
||||
{
|
||||
auto width = gfx_get_string_width(line.c_str());
|
||||
auto width = gfx_get_string_width(line.c_str(), FontSpriteBase::MEDIUM);
|
||||
_changelogLongestLineWidth = std::max(width, _changelogLongestLineWidth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ public:
|
||||
|
||||
if (page == WINDOW_CHEATS_PAGE_MONEY)
|
||||
{
|
||||
uint8_t colour = colours[1];
|
||||
auto colour = colours[1];
|
||||
auto ft = Formatter();
|
||||
ft.Add<money32>(_moneySpinnerValue);
|
||||
if (IsWidgetDisabled(WIDX_MONEY_SPINNER))
|
||||
@@ -622,29 +622,28 @@ public:
|
||||
colour |= COLOUR_FLAG_INSET;
|
||||
}
|
||||
int32_t actual_month = _monthSpinnerValue - 1;
|
||||
gfx_draw_string_left(&dpi, STR_BOTTOM_TOOLBAR_CASH, ft.Data(), colour, windowPos + ScreenCoordsXY{ X_LCOL, 93 });
|
||||
gfx_draw_string_left(&dpi, STR_YEAR, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 198 });
|
||||
gfx_draw_string_left(&dpi, STR_MONTH, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 219 });
|
||||
gfx_draw_string_left(&dpi, STR_DAY, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 240 });
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 93 }, STR_BOTTOM_TOOLBAR_CASH, ft, { colour });
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 198 }, STR_YEAR);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 219 }, STR_MONTH);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 240 }, STR_DAY);
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(_yearSpinnerValue);
|
||||
DrawTextBasic(
|
||||
&dpi, windowPos + ScreenCoordsXY{ X_RCOL, 198 }, STR_FORMAT_INTEGER, ft, colours[1], TextAlignment::RIGHT);
|
||||
&dpi, windowPos + ScreenCoordsXY{ X_RCOL, 198 }, STR_FORMAT_INTEGER, ft, { colours[1], TextAlignment::RIGHT });
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(actual_month);
|
||||
DrawTextBasic(
|
||||
&dpi, windowPos + ScreenCoordsXY{ X_RCOL, 219 }, STR_FORMAT_MONTH, ft, colours[1], TextAlignment::RIGHT);
|
||||
&dpi, windowPos + ScreenCoordsXY{ X_RCOL, 219 }, STR_FORMAT_MONTH, ft, { colours[1], TextAlignment::RIGHT });
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(_daySpinnerValue);
|
||||
DrawTextBasic(
|
||||
&dpi, windowPos + ScreenCoordsXY{ X_RCOL, 240 }, STR_FORMAT_INTEGER, ft, colours[1], TextAlignment::RIGHT);
|
||||
&dpi, windowPos + ScreenCoordsXY{ X_RCOL, 240 }, STR_FORMAT_INTEGER, ft, { colours[1], TextAlignment::RIGHT });
|
||||
}
|
||||
else if (page == WINDOW_CHEATS_PAGE_MISC)
|
||||
{
|
||||
{
|
||||
auto& widget = widgets[WIDX_WEATHER];
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHANGE_WEATHER, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL - 3, widget.top + 1 });
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL - 3, widget.top + 1 }, STR_CHANGE_WEATHER);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -653,33 +652,25 @@ public:
|
||||
|
||||
auto& widget = widgets[WIDX_PARK_RATING_SPINNER];
|
||||
DrawTextBasic(
|
||||
&dpi, windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 2 }, STR_FORMAT_INTEGER, ft, colours[1]);
|
||||
&dpi, windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 2 }, STR_FORMAT_INTEGER, ft,
|
||||
{ colours[1] });
|
||||
}
|
||||
|
||||
{
|
||||
auto& widget = widgets[WIDX_STAFF_SPEED];
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHEAT_STAFF_SPEED, nullptr, COLOUR_BLACK,
|
||||
windowPos + ScreenCoordsXY{ X_LCOL - 3, widget.top + 1 });
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL - 3, widget.top + 1 }, STR_CHEAT_STAFF_SPEED);
|
||||
}
|
||||
}
|
||||
else if (page == WINDOW_CHEATS_PAGE_GUESTS)
|
||||
{
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHEAT_GUEST_HAPPINESS, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 72 });
|
||||
gfx_draw_string_left(&dpi, STR_CHEAT_GUEST_ENERGY, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 93 });
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHEAT_GUEST_HUNGER, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 114 });
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHEAT_GUEST_THIRST, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 135 });
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHEAT_GUEST_NAUSEA, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 156 });
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHEAT_GUEST_NAUSEA_TOLERANCE, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 177 });
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHEAT_GUEST_TOILET, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 198 });
|
||||
gfx_draw_string_left(
|
||||
&dpi, STR_CHEAT_GUEST_PREFERRED_INTENSITY, nullptr, COLOUR_BLACK, windowPos + ScreenCoordsXY{ X_LCOL, 219 });
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 72 }, STR_CHEAT_GUEST_HAPPINESS);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 93 }, STR_CHEAT_GUEST_ENERGY);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 114 }, STR_CHEAT_GUEST_HUNGER);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 135 }, STR_CHEAT_GUEST_THIRST);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 156 }, STR_CHEAT_GUEST_NAUSEA);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 177 }, STR_CHEAT_GUEST_NAUSEA_TOLERANCE);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 198 }, STR_CHEAT_GUEST_TOILET);
|
||||
DrawTextBasic(&dpi, windowPos + ScreenCoordsXY{ X_LCOL, 219 }, STR_CHEAT_GUEST_PREFERRED_INTENSITY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -222,8 +222,8 @@ static void window_clear_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
w->windowPos.y + window_clear_scenery_widgets[WIDX_PREVIEW].midY() };
|
||||
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
|
||||
{
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize);
|
||||
DrawTextBasic(
|
||||
dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
// Draw cost amount
|
||||
@@ -231,6 +231,6 @@ static void window_clear_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
screenCoords.x = window_clear_scenery_widgets[WIDX_PREVIEW].midX() + w->windowPos.x;
|
||||
screenCoords.y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 5 + 27;
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gClearSceneryCost);
|
||||
DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, &gClearSceneryCost, { TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,38 +218,28 @@ static void custom_currency_window_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
auto screenCoords = w->windowPos + ScreenCoordsXY{ 10, 30 };
|
||||
|
||||
gfx_draw_string_left(dpi, STR_RATE, nullptr, w->colours[1], screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_RATE, {}, { w->colours[1] });
|
||||
|
||||
int32_t baseExchange = CurrencyDescriptors[EnumValue(CurrencyType::Pounds)].rate;
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(baseExchange);
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_CUSTOM_CURRENCY_EQUIVALENCY, ft.Data(), w->colours[1], screenCoords + ScreenCoordsXY{ 200, 0 });
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 200, 0 }, STR_CUSTOM_CURRENCY_EQUIVALENCY, ft, { w->colours[1] });
|
||||
|
||||
screenCoords.y += 20;
|
||||
|
||||
gfx_draw_string_left(dpi, STR_CURRENCY_SYMBOL_TEXT, nullptr, w->colours[1], screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_SYMBOL_TEXT, {}, { w->colours[1] });
|
||||
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ window_custom_currency_widgets[WIDX_SYMBOL_TEXT].left + 1,
|
||||
window_custom_currency_widgets[WIDX_SYMBOL_TEXT].top };
|
||||
|
||||
gfx_draw_string(dpi, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, w->colours[1], screenCoords);
|
||||
gfx_draw_string(dpi, screenCoords, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode, { w->colours[1] });
|
||||
|
||||
if (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix)
|
||||
{
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_PREFIX, w, w->colours[1],
|
||||
w->windowPos
|
||||
+ ScreenCoordsXY{ window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].left + 1,
|
||||
window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].top });
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_SUFFIX, w, w->colours[1],
|
||||
w->windowPos
|
||||
+ ScreenCoordsXY{ window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].left + 1,
|
||||
window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].top });
|
||||
}
|
||||
auto drawPos = w->windowPos
|
||||
+ ScreenCoordsXY{ window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].left + 1,
|
||||
window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].top };
|
||||
rct_string_id stringId = (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix)
|
||||
? STR_PREFIX
|
||||
: STR_SUFFIX;
|
||||
DrawTextBasic(dpi, drawPos, stringId, w, { w->colours[1] });
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ static void window_debug_paint_invalidate(rct_window* w)
|
||||
auto stringIdx = w->widgets[widgetIndex].text;
|
||||
auto string = ls.GetString(stringIdx);
|
||||
Guard::ArgumentNotNull(string);
|
||||
auto width = gfx_get_string_width(string);
|
||||
auto width = gfx_get_string_width(string, FontSpriteBase::MEDIUM);
|
||||
newWidth = std::max<int16_t>(width, newWidth);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ static void window_ride_demolish_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
ft.Add<money32>(_demolishRideCost);
|
||||
|
||||
ScreenCoordsXY stringCoords(w->windowPos.x + WW / 2, w->windowPos.y + (WH / 2) - 3);
|
||||
gfx_draw_string_centred_wrapped(dpi, ft.Data(), stringCoords, WW - 4, stringId, COLOUR_BLACK);
|
||||
DrawTextWrapped(dpi, stringCoords, WW - 4, stringId, ft, { TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +187,6 @@ static void window_ride_refurbish_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
ft.Add<money32>(_demolishRideCost / 2);
|
||||
|
||||
ScreenCoordsXY stringCoords(w->windowPos.x + WW / 2, w->windowPos.y + (WH / 2) - 3);
|
||||
gfx_draw_string_centred_wrapped(dpi, ft.Data(), stringCoords, WW - 4, stringId, COLOUR_BLACK);
|
||||
DrawTextWrapped(dpi, stringCoords, WW - 4, stringId, ft, { TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,8 +118,7 @@ void WindowDropdownShowText(const ScreenCoordsXY& screenPos, int32_t extray, uin
|
||||
for (size_t i = 0; i < num_items; i++)
|
||||
{
|
||||
format_string(buffer, 256, gDropdownItemsFormat[i], static_cast<void*>(&gDropdownItemsArgs[i]));
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
string_width = gfx_get_string_width(buffer);
|
||||
string_width = gfx_get_string_width(buffer, FontSpriteBase::MEDIUM);
|
||||
max_string_width = std::max(string_width, max_string_width);
|
||||
}
|
||||
|
||||
@@ -287,7 +286,7 @@ void WindowDropdownClose()
|
||||
|
||||
static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t cell_x, cell_y, l, t, r, b, item, image, colour;
|
||||
int32_t cell_x, cell_y, l, t, r, b, item, image;
|
||||
|
||||
WindowDrawWidgets(w, dpi);
|
||||
|
||||
@@ -362,7 +361,7 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
}
|
||||
|
||||
// Calculate colour
|
||||
colour = NOT_TRANSLUCENT(w->colours[0]);
|
||||
colour_t colour = NOT_TRANSLUCENT(w->colours[0]);
|
||||
if (i == highlightedIndex)
|
||||
colour = COLOUR_WHITE;
|
||||
if (Dropdown::IsDisabled(i))
|
||||
@@ -373,7 +372,7 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
ScreenCoordsXY screenCoords = { w->windowPos.x + 2 + (cell_x * _dropdown_item_width),
|
||||
w->windowPos.y + 2 + (cell_y * _dropdown_item_height) };
|
||||
Formatter ft(reinterpret_cast<uint8_t*>(&gDropdownItemsArgs[i]));
|
||||
DrawTextEllipsised(dpi, screenCoords, w->width - 5, item, ft, colour);
|
||||
DrawTextEllipsised(dpi, screenCoords, w->width - 5, item, ft, { colour });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,9 +434,9 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
/ 2
|
||||
+ w->windowPos.x;
|
||||
int16_t stateY = w->height - 0x0C + w->windowPos.y;
|
||||
gfx_draw_string_centred(
|
||||
dpi, EditorStepNames[EnumValue(gS6Info.editor_step)], { stateX, stateY },
|
||||
NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE, nullptr);
|
||||
DrawTextBasic(
|
||||
dpi, { stateX, stateY }, EditorStepNames[EnumValue(gS6Info.editor_step)], {},
|
||||
{ static_cast<colour_t>(NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE), TextAlignment::CENTRE });
|
||||
|
||||
if (drawPreviousButton)
|
||||
{
|
||||
@@ -447,7 +447,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 },
|
||||
0);
|
||||
|
||||
int32_t textColour = NOT_TRANSLUCENT(w->colours[1]);
|
||||
colour_t textColour = NOT_TRANSLUCENT(w->colours[1]);
|
||||
if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR
|
||||
&& gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON)
|
||||
{
|
||||
@@ -464,8 +464,8 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
stringId = STR_EDITOR_STEP_OBJECT_SELECTION;
|
||||
|
||||
gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, { textX, textY }, textColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, stringId, { textX, textY + 10 }, textColour, nullptr);
|
||||
DrawTextBasic(dpi, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::CENTRE });
|
||||
DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EditorStep::RollercoasterDesigner)
|
||||
@@ -477,7 +477,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 },
|
||||
0);
|
||||
|
||||
int32_t textColour = NOT_TRANSLUCENT(w->colours[1]);
|
||||
colour_t textColour = NOT_TRANSLUCENT(w->colours[1]);
|
||||
|
||||
if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON)
|
||||
{
|
||||
@@ -494,8 +494,8 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER;
|
||||
|
||||
gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, { textX, textY }, textColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, stringId, { textX, textY + 10 }, textColour, nullptr);
|
||||
DrawTextBasic(dpi, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::CENTRE });
|
||||
DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,12 +509,12 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
|
||||
// Pre-researched items label
|
||||
screenPos = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_PRE_RESEARCHED_SCROLL].left, w->widgets[WIDX_PRE_RESEARCHED_SCROLL].top - 11 };
|
||||
gfx_draw_string_left(dpi, STR_INVENTION_PREINVENTED_ITEMS, nullptr, COLOUR_BLACK, screenPos - ScreenCoordsXY{ 0, 1 });
|
||||
DrawTextBasic(dpi, screenPos - ScreenCoordsXY{ 0, 1 }, STR_INVENTION_PREINVENTED_ITEMS);
|
||||
|
||||
// Research order label
|
||||
screenPos = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_RESEARCH_ORDER_SCROLL].left, w->widgets[WIDX_RESEARCH_ORDER_SCROLL].top - 11 };
|
||||
gfx_draw_string_left(dpi, STR_INVENTION_TO_BE_INVENTED_ITEMS, nullptr, COLOUR_BLACK, screenPos - ScreenCoordsXY{ 0, 1 });
|
||||
DrawTextBasic(dpi, screenPos - ScreenCoordsXY{ 0, 1 }, STR_INVENTION_TO_BE_INVENTED_ITEMS);
|
||||
|
||||
// Preview background
|
||||
widget = &w->widgets[WIDX_PREVIEW];
|
||||
@@ -561,13 +561,13 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
|
||||
width = w->width - w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right - 6;
|
||||
|
||||
auto [drawString, ft] = window_editor_inventions_list_prepare_name(researchItem, false);
|
||||
DrawTextEllipsised(dpi, screenPos, width, drawString, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenPos, width, drawString, ft, { TextAlignment::CENTRE });
|
||||
screenPos.y += 15;
|
||||
|
||||
// Item category
|
||||
screenPos.x = w->windowPos.x + w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right + 4;
|
||||
stringId = researchItem->GetCategoryInventionString();
|
||||
gfx_draw_string_left(dpi, STR_INVENTION_RESEARCH_GROUP, &stringId, COLOUR_BLACK, screenPos);
|
||||
DrawTextBasic(dpi, screenPos, STR_INVENTION_RESEARCH_GROUP, &stringId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -613,22 +613,19 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
|
||||
if (researchItem.Equals(&_editorInventionsListDraggedItem))
|
||||
continue;
|
||||
|
||||
uint8_t colour;
|
||||
// TODO: this parameter by itself produces very light text.
|
||||
// It needs a {BLACK} token in the string to work properly.
|
||||
colour_t colour = COLOUR_BLACK;
|
||||
FontSpriteBase fontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
if (researchItem.IsAlwaysResearched())
|
||||
{
|
||||
if (w->research_item == &researchItem && _editorInventionsListDraggedItem.IsNull())
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_EXTRA_DARK;
|
||||
fontSpriteBase = FontSpriteBase::MEDIUM_EXTRA_DARK;
|
||||
else
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK;
|
||||
fontSpriteBase = FontSpriteBase::MEDIUM_DARK;
|
||||
colour = w->colours[1] | COLOUR_FLAG_INSET;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: this parameter by itself produces very light text.
|
||||
// It needs a {BLACK} token in the string to work properly.
|
||||
colour = COLOUR_BLACK;
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
}
|
||||
|
||||
const rct_string_id itemNameId = researchItem.GetName();
|
||||
|
||||
@@ -642,19 +639,22 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(rideTypeName);
|
||||
DrawTextEllipsised(
|
||||
dpi, { 1, itemY }, columnSplitOffset - 11, STR_INVENTIONS_LIST_RIDE_AND_VEHICLE_NAME, ft, colour);
|
||||
dpi, { 1, itemY }, columnSplitOffset - 11, STR_INVENTIONS_LIST_RIDE_AND_VEHICLE_NAME, ft,
|
||||
{ colour, fontSpriteBase });
|
||||
|
||||
// Draw vehicle name
|
||||
ft = Formatter();
|
||||
ft.Add<rct_string_id>(itemNameId);
|
||||
DrawTextEllipsised(dpi, { columnSplitOffset + 1, itemY }, columnSplitOffset - 11, STR_BLACK_STRING, ft, colour);
|
||||
DrawTextEllipsised(
|
||||
dpi, { columnSplitOffset + 1, itemY }, columnSplitOffset - 11, STR_BLACK_STRING, ft,
|
||||
{ colour, fontSpriteBase });
|
||||
}
|
||||
else
|
||||
{
|
||||
// Scenery group, flat ride or shop
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(itemNameId);
|
||||
DrawTextEllipsised(dpi, { 1, itemY }, boxWidth, STR_BLACK_STRING, ft, colour);
|
||||
DrawTextEllipsised(dpi, { 1, itemY }, boxWidth, STR_BLACK_STRING, ft, { colour, fontSpriteBase });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -689,7 +689,7 @@ static void window_editor_inventions_list_drag_open(ResearchItem* researchItem)
|
||||
format_string(ptr, 256, stringId, nullptr);
|
||||
}
|
||||
|
||||
auto stringWidth = gfx_get_string_width(buffer);
|
||||
auto stringWidth = gfx_get_string_width(buffer, FontSpriteBase::MEDIUM);
|
||||
window_editor_inventions_list_drag_widgets[0].right = stringWidth;
|
||||
|
||||
auto* w = WindowCreate(
|
||||
@@ -757,7 +757,7 @@ static void window_editor_inventions_list_drag_paint(rct_window* w, rct_drawpixe
|
||||
auto screenCoords = w->windowPos + ScreenCoordsXY{ 0, 2 };
|
||||
|
||||
auto [drawString, ft] = window_editor_inventions_list_prepare_name(&_editorInventionsListDraggedItem, true);
|
||||
DrawTextBasic(dpi, screenCoords, drawString, ft, COLOUR_BLACK | COLOUR_FLAG_OUTLINE);
|
||||
DrawTextBasic(dpi, screenCoords, drawString, ft, { COLOUR_BLACK | COLOUR_FLAG_OUTLINE });
|
||||
}
|
||||
|
||||
static std::pair<rct_string_id, Formatter> window_editor_inventions_list_prepare_name(
|
||||
|
||||
@@ -1006,7 +1006,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(numSelected);
|
||||
ft.Add<uint16_t>(totalSelectable);
|
||||
gfx_draw_string_left(dpi, STR_OBJECT_SELECTION_SELECTION_SIZE, ft.Data(), COLOUR_BLACK, screenPos);
|
||||
DrawTextBasic(dpi, screenPos, STR_OBJECT_SELECTION_SELECTION_SIZE, ft);
|
||||
}
|
||||
|
||||
// Draw sort button text
|
||||
@@ -1018,7 +1018,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
: STR_NONE;
|
||||
ft.Add<rct_string_id>(stringId);
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
|
||||
DrawTextEllipsised(dpi, screenPos, widget->width(), STR_OBJECTS_SORT_TYPE, ft, w->colours[1]);
|
||||
DrawTextEllipsised(dpi, screenPos, widget->width(), STR_OBJECTS_SORT_TYPE, ft, { w->colours[1] });
|
||||
}
|
||||
widget = &w->widgets[WIDX_LIST_SORT_RIDE];
|
||||
if (widget->type != WindowWidgetType::Empty)
|
||||
@@ -1028,7 +1028,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
: STR_NONE;
|
||||
ft.Add<rct_string_id>(stringId);
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
|
||||
DrawTextEllipsised(dpi, screenPos, widget->width(), STR_OBJECTS_SORT_RIDE, ft, w->colours[1]);
|
||||
DrawTextEllipsised(dpi, screenPos, widget->width(), STR_OBJECTS_SORT_RIDE, ft, { w->colours[1] });
|
||||
}
|
||||
|
||||
if (w->selected_list_item == -1 || _loadedObject == nullptr)
|
||||
@@ -1056,7 +1056,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(listItem->repositoryItem->Name.c_str());
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_WINDOW_COLOUR_2_STRINGID, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
// Draw description of object
|
||||
@@ -1070,8 +1070,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_LIST].right + 4, widget->bottom + 18 };
|
||||
width = w->windowPos.x + w->width - screenPos.x - 4;
|
||||
|
||||
gfx_draw_string_left_wrapped(
|
||||
dpi, ft.Data(), screenPos + ScreenCoordsXY{ 0, 5 }, width, STR_WINDOW_COLOUR_2_STRINGID, COLOUR_BLACK);
|
||||
DrawTextWrapped(dpi, screenPos + ScreenCoordsXY{ 0, 5 }, width, STR_WINDOW_COLOUR_2_STRINGID, ft);
|
||||
}
|
||||
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ w->width - 5, w->height - (LIST_ROW_HEIGHT * 5) };
|
||||
@@ -1080,14 +1079,14 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
if (get_selected_object_type(w) == ObjectType::Ride)
|
||||
{
|
||||
auto stringId = get_ride_type_string_id(listItem->repositoryItem);
|
||||
DrawTextBasic(dpi, screenPos, stringId, {}, COLOUR_WHITE, TextAlignment::RIGHT);
|
||||
DrawTextBasic(dpi, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT });
|
||||
}
|
||||
|
||||
screenPos.y += LIST_ROW_HEIGHT;
|
||||
|
||||
// Draw object source
|
||||
auto stringId = object_manager_get_source_game_string(listItem->repositoryItem->GetFirstSourceGame());
|
||||
DrawTextBasic(dpi, screenPos, stringId, {}, COLOUR_WHITE, TextAlignment::RIGHT);
|
||||
DrawTextBasic(dpi, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT });
|
||||
screenPos.y += LIST_ROW_HEIGHT;
|
||||
|
||||
// Draw object dat name
|
||||
@@ -1097,8 +1096,8 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(path);
|
||||
DrawTextBasic(
|
||||
dpi, { w->windowPos.x + w->width - 5, screenPos.y }, STR_WINDOW_COLOUR_2_STRINGID, ft, COLOUR_BLACK,
|
||||
TextAlignment::RIGHT);
|
||||
dpi, { w->windowPos.x + w->width - 5, screenPos.y }, STR_WINDOW_COLOUR_2_STRINGID, ft,
|
||||
{ COLOUR_BLACK, TextAlignment::RIGHT });
|
||||
screenPos.y += LIST_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
@@ -1118,7 +1117,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
ft.Add<const char*>(authorsString.c_str());
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->width - 5, screenPos.y }, w->width - w->widgets[WIDX_LIST].right - 4,
|
||||
STR_WINDOW_COLOUR_2_STRINGID, ft, COLOUR_BLACK, TextAlignment::RIGHT);
|
||||
STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::RIGHT });
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -1127,7 +1126,6 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
*/
|
||||
static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
|
||||
{
|
||||
int32_t colour, colour2;
|
||||
ScreenCoordsXY screenCoords;
|
||||
|
||||
bool ridePage = (get_selected_object_type(w) == ObjectType::Ride);
|
||||
@@ -1156,12 +1154,14 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && (*listItem.flags & OBJECT_SELECTION_FLAG_SELECTED))
|
||||
{
|
||||
screenCoords.x = 2;
|
||||
gCurrentFontSpriteBase = highlighted ? FONT_SPRITE_BASE_MEDIUM_EXTRA_DARK : FONT_SPRITE_BASE_MEDIUM_DARK;
|
||||
colour2 = NOT_TRANSLUCENT(w->colours[1]);
|
||||
FontSpriteBase fontSpriteBase = highlighted ? FontSpriteBase::MEDIUM_EXTRA_DARK : FontSpriteBase::MEDIUM_DARK;
|
||||
colour_t colour2 = NOT_TRANSLUCENT(w->colours[1]);
|
||||
if (*listItem.flags & (OBJECT_SELECTION_FLAG_IN_USE | OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED))
|
||||
colour2 |= COLOUR_FLAG_INSET;
|
||||
|
||||
gfx_draw_string(dpi, static_cast<const char*>(CheckBoxMarkString), colour2, screenCoords);
|
||||
gfx_draw_string(
|
||||
dpi, screenCoords, static_cast<const char*>(CheckBoxMarkString),
|
||||
{ static_cast<colour_t>(colour2), fontSpriteBase });
|
||||
}
|
||||
|
||||
screenCoords.x = gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 15;
|
||||
@@ -1169,15 +1169,12 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
||||
auto bufferWithColour = strcpy(gCommonStringFormatBuffer, highlighted ? "{WINDOW_COLOUR_2}" : "{BLACK}");
|
||||
auto buffer = strchr(bufferWithColour, '\0');
|
||||
|
||||
colour_t colour = COLOUR_BLACK;
|
||||
FontSpriteBase fontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
if (*listItem.flags & OBJECT_SELECTION_FLAG_6)
|
||||
{
|
||||
colour = w->colours[1] & 0x7F;
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK;
|
||||
}
|
||||
else
|
||||
{
|
||||
colour = COLOUR_BLACK;
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
fontSpriteBase = FontSpriteBase::MEDIUM_DARK;
|
||||
}
|
||||
|
||||
int32_t width_limit = w->widgets[WIDX_LIST].width() - screenCoords.x;
|
||||
@@ -1190,7 +1187,7 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
||||
safe_strcpy(buffer, language_get_string(rideTypeStringId), 256 - (buffer - bufferWithColour));
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(gCommonStringFormatBuffer);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit - 15, STR_STRING, ft, colour);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit - 15, STR_STRING, ft, { colour, fontSpriteBase });
|
||||
screenCoords.x = w->widgets[WIDX_LIST_SORT_RIDE].left - w->widgets[WIDX_LIST].left;
|
||||
}
|
||||
|
||||
@@ -1205,7 +1202,7 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
||||
}
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(gCommonStringFormatBuffer);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, colour);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, { colour, fontSpriteBase });
|
||||
}
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
@@ -797,12 +797,12 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
|
||||
|
||||
// Objective label
|
||||
auto screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_OBJECTIVE].top };
|
||||
gfx_draw_string_left(dpi, STR_OBJECTIVE_WINDOW, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_OBJECTIVE_WINDOW);
|
||||
|
||||
// Objective value
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_OBJECTIVE].left + 1, w->widgets[WIDX_OBJECTIVE].top };
|
||||
stringId = ObjectiveDropdownOptionNames[gScenarioObjective.Type];
|
||||
gfx_draw_string_left(dpi, STR_WINDOW_COLOUR_2_STRINGID, &stringId, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, &stringId);
|
||||
|
||||
if (w->widgets[WIDX_OBJECTIVE_ARG_1].type != WindowWidgetType::Empty)
|
||||
{
|
||||
@@ -831,7 +831,7 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
|
||||
stringId = STR_WINDOW_OBJECTIVE_EXCITEMENT_RATING;
|
||||
break;
|
||||
}
|
||||
gfx_draw_string_left(dpi, stringId, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, stringId);
|
||||
|
||||
// Objective argument 1 value
|
||||
screenCoords = w->windowPos
|
||||
@@ -863,20 +863,20 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
|
||||
arg = gScenarioObjective.Currency;
|
||||
break;
|
||||
}
|
||||
gfx_draw_string_left(dpi, stringId, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, stringId, &arg, COLOUR_BLACK);
|
||||
}
|
||||
|
||||
if (w->widgets[WIDX_OBJECTIVE_ARG_2].type != WindowWidgetType::Empty)
|
||||
{
|
||||
// Objective argument 2 label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 28, w->widgets[WIDX_OBJECTIVE_ARG_2].top };
|
||||
gfx_draw_string_left(dpi, STR_WINDOW_OBJECTIVE_DATE, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_DATE);
|
||||
|
||||
// Objective argument 2 value
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_OBJECTIVE_ARG_2].left + 1, w->widgets[WIDX_OBJECTIVE_ARG_2].top };
|
||||
arg = (gScenarioObjective.Year * MONTH_COUNT) - 1;
|
||||
gfx_draw_string_left(dpi, STR_WINDOW_OBJECTIVE_VALUE_DATE, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_VALUE_DATE, &arg);
|
||||
}
|
||||
|
||||
// Park name
|
||||
@@ -890,7 +890,7 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(parkName);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_PARK_NAME, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_PARK_NAME, ft);
|
||||
}
|
||||
|
||||
// Scenario name
|
||||
@@ -900,11 +900,11 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(gS6Info.name);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_SCENARIO_NAME, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_SCENARIO_NAME, ft);
|
||||
|
||||
// Scenario details label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_DETAILS].top };
|
||||
gfx_draw_string_left(dpi, STR_WINDOW_PARK_DETAILS, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_PARK_DETAILS);
|
||||
|
||||
// Scenario details value
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 16, w->widgets[WIDX_DETAILS].top + 10 };
|
||||
@@ -913,16 +913,16 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
|
||||
ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(gS6Info.details);
|
||||
gfx_draw_string_left_wrapped(dpi, ft.Data(), screenCoords, width, STR_BLACK_STRING, COLOUR_BLACK);
|
||||
DrawTextWrapped(dpi, screenCoords, width, STR_BLACK_STRING, ft);
|
||||
|
||||
// Scenario category label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_CATEGORY].top };
|
||||
gfx_draw_string_left(dpi, STR_WINDOW_SCENARIO_GROUP, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_SCENARIO_GROUP);
|
||||
|
||||
// Scenario category value
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_CATEGORY].left + 1, w->widgets[WIDX_CATEGORY].top };
|
||||
stringId = ScenarioCategoryStringIds[gS6Info.category];
|
||||
gfx_draw_string_left(dpi, STR_WINDOW_COLOUR_2_STRINGID, &stringId, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, &stringId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1062,9 +1062,8 @@ static void window_editor_objective_options_rides_paint(rct_window* w, rct_drawp
|
||||
WindowDrawWidgets(w, dpi);
|
||||
window_editor_objective_options_draw_tab_images(w, dpi);
|
||||
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_WINDOW_PRESERVATION_ORDER, nullptr, COLOUR_BLACK,
|
||||
w->windowPos + ScreenCoordsXY{ 6, w->widgets[WIDX_PAGE_BACKGROUND].top + 3 });
|
||||
DrawTextBasic(
|
||||
dpi, w->windowPos + ScreenCoordsXY{ 6, w->widgets[WIDX_PAGE_BACKGROUND].top + 3 }, STR_WINDOW_PRESERVATION_ORDER);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1100,16 +1099,18 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window* w, rct
|
||||
{
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE)
|
||||
{
|
||||
gCurrentFontSpriteBase = stringId == STR_WINDOW_COLOUR_2_STRINGID ? FONT_SPRITE_BASE_MEDIUM_EXTRA_DARK
|
||||
: FONT_SPRITE_BASE_MEDIUM_DARK;
|
||||
gfx_draw_string(dpi, static_cast<const char*>(CheckBoxMarkString), w->colours[1] & 0x7F, { 2, y });
|
||||
FontSpriteBase fontSpriteBase = stringId == STR_WINDOW_COLOUR_2_STRINGID ? FontSpriteBase::MEDIUM_EXTRA_DARK
|
||||
: FontSpriteBase::MEDIUM_DARK;
|
||||
gfx_draw_string(
|
||||
dpi, { 2, y }, static_cast<const char*>(CheckBoxMarkString),
|
||||
{ static_cast<colour_t>(w->colours[1] & 0x7F), fontSpriteBase });
|
||||
}
|
||||
|
||||
// Ride name
|
||||
|
||||
Formatter ft;
|
||||
ride->FormatNameTo(ft);
|
||||
gfx_draw_string_left(dpi, stringId, ft.Data(), COLOUR_BLACK, { 15, y });
|
||||
DrawTextBasic(dpi, { 15, y }, stringId, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -686,43 +686,43 @@ static void window_editor_scenario_options_financial_paint(rct_window* w, rct_dr
|
||||
if (w->widgets[WIDX_INITIAL_CASH].type != WindowWidgetType::Empty)
|
||||
{
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_INITIAL_CASH].top };
|
||||
gfx_draw_string_left(dpi, STR_INIT_CASH_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_INIT_CASH_LABEL);
|
||||
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_INITIAL_CASH].left + 1, w->widgets[WIDX_INITIAL_CASH].top };
|
||||
gfx_draw_string_left(dpi, STR_CURRENCY_FORMAT_LABEL, &gInitialCash, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &gInitialCash);
|
||||
}
|
||||
|
||||
if (w->widgets[WIDX_INITIAL_LOAN].type != WindowWidgetType::Empty)
|
||||
{
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_INITIAL_LOAN].top };
|
||||
gfx_draw_string_left(dpi, STR_INIT_LOAN_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_INIT_LOAN_LABEL);
|
||||
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_INITIAL_LOAN].left + 1, w->widgets[WIDX_INITIAL_LOAN].top };
|
||||
gfx_draw_string_left(dpi, STR_CURRENCY_FORMAT_LABEL, &gBankLoan, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &gBankLoan);
|
||||
}
|
||||
|
||||
if (w->widgets[WIDX_MAXIMUM_LOAN].type != WindowWidgetType::Empty)
|
||||
{
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_MAXIMUM_LOAN].top };
|
||||
gfx_draw_string_left(dpi, STR_MAX_LOAN_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_MAX_LOAN_LABEL);
|
||||
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_MAXIMUM_LOAN].left + 1, w->widgets[WIDX_MAXIMUM_LOAN].top };
|
||||
gfx_draw_string_left(dpi, STR_CURRENCY_FORMAT_LABEL, &gMaxBankLoan, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &gMaxBankLoan);
|
||||
}
|
||||
|
||||
if (w->widgets[WIDX_INTEREST_RATE].type != WindowWidgetType::Empty)
|
||||
{
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_INTEREST_RATE].top };
|
||||
gfx_draw_string_left(dpi, STR_INTEREST_RATE_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_INTEREST_RATE_LABEL);
|
||||
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_INTEREST_RATE].left + 1, w->widgets[WIDX_INTEREST_RATE].top };
|
||||
|
||||
int16_t interestRate = std::clamp<int16_t>(static_cast<int16_t>(gBankLoanInterestRate), INT16_MIN, INT16_MAX);
|
||||
gfx_draw_string_left(dpi, STR_PERCENT_FORMAT_LABEL, &interestRate, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, &interestRate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,44 +965,44 @@ static void window_editor_scenario_options_guests_paint(rct_window* w, rct_drawp
|
||||
{
|
||||
// Cash per guest label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_CASH_PER_GUEST].top };
|
||||
gfx_draw_string_left(dpi, STR_CASH_PER_GUEST_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CASH_PER_GUEST_LABEL);
|
||||
|
||||
// Cash per guest value
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_CASH_PER_GUEST].left + 1, w->widgets[WIDX_CASH_PER_GUEST].top };
|
||||
arg = gGuestInitialCash;
|
||||
gfx_draw_string_left(dpi, STR_CURRENCY_FORMAT_LABEL, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &arg);
|
||||
}
|
||||
|
||||
// Guest initial happiness label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].top };
|
||||
gfx_draw_string_left(dpi, STR_GUEST_INIT_HAPPINESS, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_HAPPINESS);
|
||||
|
||||
// Guest initial happiness value
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].left + 1, w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].top };
|
||||
arg = (gGuestInitialHappiness * 100) / 255;
|
||||
gfx_draw_string_left(dpi, STR_PERCENT_FORMAT_LABEL, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, &arg);
|
||||
|
||||
// Guest initial hunger label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_GUEST_INITIAL_HUNGER].top };
|
||||
gfx_draw_string_left(dpi, STR_GUEST_INIT_HUNGER, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_HUNGER);
|
||||
|
||||
// Guest initial hunger value
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_GUEST_INITIAL_HUNGER].left + 1, w->widgets[WIDX_GUEST_INITIAL_HUNGER].top };
|
||||
arg = ((255 - gGuestInitialHunger) * 100) / 255;
|
||||
gfx_draw_string_left(dpi, STR_PERCENT_FORMAT_LABEL, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, &arg);
|
||||
|
||||
// Guest initial thirst label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_GUEST_INITIAL_THIRST].top };
|
||||
gfx_draw_string_left(dpi, STR_GUEST_INIT_THIRST, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_GUEST_INIT_THIRST);
|
||||
|
||||
// Guest initial thirst value
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_GUEST_INITIAL_THIRST].left + 1, w->widgets[WIDX_GUEST_INITIAL_THIRST].top };
|
||||
arg = ((255 - gGuestInitialThirst) * 100) / 255;
|
||||
gfx_draw_string_left(dpi, STR_PERCENT_FORMAT_LABEL, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, &arg);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
@@ -1327,26 +1327,26 @@ static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpix
|
||||
{
|
||||
// Cost to buy land label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_LAND_COST].top };
|
||||
gfx_draw_string_left(dpi, STR_LAND_COST_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_LAND_COST_LABEL);
|
||||
|
||||
// Cost to buy land value
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_LAND_COST].left + 1, w->widgets[WIDX_LAND_COST].top };
|
||||
arg = gLandPrice;
|
||||
gfx_draw_string_left(dpi, STR_CURRENCY_FORMAT_LABEL, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &arg);
|
||||
}
|
||||
|
||||
if (w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].type != WindowWidgetType::Empty)
|
||||
{
|
||||
// Cost to buy construction rights label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].top };
|
||||
gfx_draw_string_left(dpi, STR_RIGHTS_COST_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_RIGHTS_COST_LABEL);
|
||||
|
||||
// Cost to buy construction rights value
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].left + 1,
|
||||
w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].top };
|
||||
arg = gConstructionRightsPrice;
|
||||
gfx_draw_string_left(dpi, STR_CURRENCY_FORMAT_LABEL, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &arg);
|
||||
}
|
||||
|
||||
if (w->widgets[WIDX_PAY_FOR_PARK_OR_RIDES].type != WindowWidgetType::Empty)
|
||||
@@ -1363,7 +1363,7 @@ static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpix
|
||||
else
|
||||
stringId = STR_PAY_PARK_ENTER;
|
||||
|
||||
gfx_draw_string_left(dpi, STR_WINDOW_COLOUR_2_STRINGID, &stringId, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, &stringId);
|
||||
}
|
||||
|
||||
if (w->widgets[WIDX_ENTRY_PRICE].type != WindowWidgetType::Empty)
|
||||
@@ -1371,22 +1371,22 @@ static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpix
|
||||
// Entry price label
|
||||
screenCoords = w->windowPos
|
||||
+ ScreenCoordsXY{ w->widgets[WIDX_PAY_FOR_PARK_OR_RIDES].right + 8, w->widgets[WIDX_ENTRY_PRICE].top };
|
||||
gfx_draw_string_left(dpi, STR_ENTRY_PRICE_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_ENTRY_PRICE_LABEL);
|
||||
|
||||
// Entry price value
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_ENTRY_PRICE].left + 1, w->widgets[WIDX_ENTRY_PRICE].top };
|
||||
arg = gParkEntranceFee;
|
||||
gfx_draw_string_left(dpi, STR_CURRENCY_FORMAT_LABEL, &arg, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &arg);
|
||||
}
|
||||
|
||||
// Climate label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_CLIMATE].top };
|
||||
gfx_draw_string_left(dpi, STR_CLIMATE_LABEL, nullptr, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_CLIMATE_LABEL);
|
||||
|
||||
// Climate value
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_CLIMATE].left + 1, w->widgets[WIDX_CLIMATE].top };
|
||||
stringId = ClimateNames[static_cast<uint8_t>(gClimate)];
|
||||
gfx_draw_string_left(dpi, STR_WINDOW_COLOUR_2_STRINGID, &stringId, COLOUR_BLACK, screenCoords);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, &stringId);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -56,7 +56,7 @@ rct_window* window_error_open(rct_string_id title, rct_string_id message, const
|
||||
|
||||
rct_window* window_error_open(std::string_view title, std::string_view message)
|
||||
{
|
||||
int32_t numLines, fontHeight, width, height, maxY;
|
||||
int32_t numLines, width, height, maxY;
|
||||
rct_window* w;
|
||||
|
||||
window_close_by_class(WC_ERROR);
|
||||
@@ -83,16 +83,14 @@ rct_window* window_error_open(std::string_view title, std::string_view message)
|
||||
if (buffer.size() <= 1)
|
||||
return nullptr;
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
width = gfx_get_string_width_new_lined(buffer.data());
|
||||
width = gfx_get_string_width_new_lined(buffer.data(), FontSpriteBase::MEDIUM);
|
||||
width = std::clamp(width, 64, 196);
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
gfx_wrap_string(buffer.data(), width + 1, &numLines, &fontHeight);
|
||||
gfx_wrap_string(buffer.data(), width + 1, FontSpriteBase::MEDIUM, &numLines);
|
||||
|
||||
_window_error_num_lines = numLines;
|
||||
width = width + 3;
|
||||
height = (numLines + 1) * font_get_line_height(FONT_SPRITE_BASE_MEDIUM) + 4;
|
||||
height = (numLines + 1) * font_get_line_height(FontSpriteBase::MEDIUM) + 4;
|
||||
|
||||
window_error_widgets[WIDX_BACKGROUND].right = width;
|
||||
window_error_widgets[WIDX_BACKGROUND].bottom = height;
|
||||
@@ -160,5 +158,5 @@ static void window_error_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
l = w->windowPos.x + (w->width + 1) / 2 - 1;
|
||||
t = w->windowPos.y + 1;
|
||||
draw_string_centred_raw(dpi, { l, t }, _window_error_num_lines, _window_error_text.data());
|
||||
draw_string_centred_raw(dpi, { l, t }, _window_error_num_lines, _window_error_text.data(), FontSpriteBase::MEDIUM);
|
||||
}
|
||||
|
||||
@@ -530,7 +530,9 @@ static void window_finances_summary_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
auto screenCoords = w->windowPos + ScreenCoordsXY{ 8, 51 };
|
||||
|
||||
// Expenditure / Income heading
|
||||
DrawTextBasic(dpi, screenCoords, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, nullptr, COLOUR_BLACK, TextAlignment::LEFT, true);
|
||||
DrawTextBasic(
|
||||
dpi, screenCoords, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, {},
|
||||
{ COLOUR_BLACK, TextUnderline::On, TextAlignment::LEFT });
|
||||
screenCoords.y += 14;
|
||||
|
||||
// Expenditure / Income row labels
|
||||
@@ -542,8 +544,7 @@ static void window_finances_summary_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
dpi, { screenCoords - ScreenCoordsXY{ 0, 1 }, screenCoords + ScreenCoordsXY{ 121, (TABLE_CELL_HEIGHT - 2) } },
|
||||
ColourMapA[w->colours[1]].lighter | 0x1000000);
|
||||
|
||||
gfx_draw_string_left(
|
||||
dpi, window_finances_summary_row_labels[i], nullptr, COLOUR_BLACK, screenCoords - ScreenCoordsXY{ 0, 1 });
|
||||
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, window_finances_summary_row_labels[i]);
|
||||
screenCoords.y += TABLE_CELL_HEIGHT;
|
||||
}
|
||||
|
||||
@@ -553,15 +554,14 @@ static void window_finances_summary_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
// Loan and interest rate
|
||||
gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_LOAN, nullptr, COLOUR_BLACK, w->windowPos + ScreenCoordsXY{ 8, 279 });
|
||||
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 8, 279 }, STR_FINANCES_SUMMARY_LOAN);
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(gBankLoanInterestRate);
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft.Data(), COLOUR_BLACK, w->windowPos + ScreenCoordsXY{ 167, 279 });
|
||||
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 167, 279 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft);
|
||||
|
||||
// Current cash
|
||||
rct_string_id stringId = gCash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL;
|
||||
gfx_draw_string_left(dpi, stringId, &gCash, COLOUR_BLACK, w->windowPos + ScreenCoordsXY{ 8, 294 });
|
||||
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 8, 294 }, stringId, &gCash);
|
||||
|
||||
// Objective related financial information
|
||||
if (gScenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME)
|
||||
@@ -569,16 +569,14 @@ static void window_finances_summary_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
money32 lastMonthProfit = finance_get_last_month_shop_profit();
|
||||
ft = Formatter();
|
||||
ft.Add<money32>(lastMonthProfit);
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, ft.Data(), COLOUR_BLACK,
|
||||
w->windowPos + ScreenCoordsXY{ 280, 279 });
|
||||
DrawTextBasic(
|
||||
dpi, w->windowPos + ScreenCoordsXY{ 280, 279 }, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Park value and company value
|
||||
gfx_draw_string_left(dpi, STR_PARK_VALUE_LABEL, &gParkValue, COLOUR_BLACK, w->windowPos + ScreenCoordsXY{ 280, 279 });
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_COMPANY_VALUE_LABEL, &gCompanyValue, COLOUR_BLACK, w->windowPos + ScreenCoordsXY{ 280, 294 });
|
||||
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, &gParkValue);
|
||||
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 280, 294 }, STR_COMPANY_VALUE_LABEL, &gCompanyValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,8 +616,8 @@ static void window_finances_summary_scrollpaint(rct_window* w, rct_drawpixelinfo
|
||||
ft.Add<uint16_t>(monthyear);
|
||||
DrawTextBasic(
|
||||
dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 },
|
||||
monthyear == currentMonthYear ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING, ft, COLOUR_BLACK,
|
||||
TextAlignment::RIGHT, true);
|
||||
monthyear == currentMonthYear ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING, ft,
|
||||
{ TextUnderline::On, TextAlignment::RIGHT });
|
||||
screenCoords.y += 14;
|
||||
|
||||
// Month expenditures
|
||||
@@ -635,8 +633,7 @@ static void window_finances_summary_scrollpaint(rct_window* w, rct_drawpixelinfo
|
||||
ft = Formatter();
|
||||
ft.Add<money32>(expenditure);
|
||||
DrawTextBasic(
|
||||
dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, COLOUR_BLACK,
|
||||
TextAlignment::RIGHT);
|
||||
dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, { TextAlignment::RIGHT });
|
||||
}
|
||||
screenCoords.y += TABLE_CELL_HEIGHT;
|
||||
}
|
||||
@@ -646,8 +643,7 @@ static void window_finances_summary_scrollpaint(rct_window* w, rct_drawpixelinfo
|
||||
const rct_string_id format = profit >= 0 ? STR_FINANCES_SUMMARY_INCOME_VALUE : STR_FINANCES_SUMMARY_LOSS_VALUE;
|
||||
ft = Formatter();
|
||||
ft.Add<money32>(profit);
|
||||
DrawTextBasic(
|
||||
dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, COLOUR_BLACK, TextAlignment::RIGHT);
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, 0 }, format, ft, { TextAlignment::RIGHT });
|
||||
|
||||
gfx_fill_rect(
|
||||
dpi, { screenCoords + ScreenCoordsXY{ 10, -2 }, screenCoords + ScreenCoordsXY{ EXPENDITURE_COLUMN_WIDTH, -2 } },
|
||||
@@ -723,11 +719,11 @@ static void window_finances_financial_graph_paint(rct_window* w, rct_drawpixelin
|
||||
// Cash (less loan)
|
||||
money32 cashLessLoan = gCash - gBankLoan;
|
||||
|
||||
gfx_draw_string_left(
|
||||
dpi,
|
||||
DrawTextBasic(
|
||||
dpi, { graphLeft, graphTop - 11 },
|
||||
cashLessLoan >= 0 ? STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_POSITIVE
|
||||
: STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_NEGATIVE,
|
||||
&cashLessLoan, COLOUR_BLACK, { graphLeft, graphTop - 11 });
|
||||
&cashLessLoan);
|
||||
|
||||
// Graph
|
||||
gfx_fill_rect_inset(dpi, graphLeft, graphTop, graphRight, graphBottom, w->colours[1], INSET_RECT_F_30);
|
||||
@@ -758,7 +754,7 @@ static void window_finances_financial_graph_paint(rct_window* w, rct_drawpixelin
|
||||
money32 axisValue = axisBase << yAxisScale;
|
||||
auto ft = Formatter();
|
||||
ft.Add<money32>(axisValue);
|
||||
DrawTextBasic(dpi, { x + 70, y }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, COLOUR_BLACK, TextAlignment::RIGHT);
|
||||
DrawTextBasic(dpi, { x + 70, y }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, { TextAlignment::RIGHT });
|
||||
gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
|
||||
y += 39;
|
||||
}
|
||||
@@ -832,7 +828,7 @@ static void window_finances_park_value_graph_paint(rct_window* w, rct_drawpixeli
|
||||
|
||||
// Park value
|
||||
money32 parkValue = gParkValue;
|
||||
gfx_draw_string_left(dpi, STR_FINANCES_PARK_VALUE, &parkValue, COLOUR_BLACK, { graphLeft, graphTop - 11 });
|
||||
DrawTextBasic(dpi, { graphLeft, graphTop - 11 }, STR_FINANCES_PARK_VALUE, &parkValue);
|
||||
|
||||
// Graph
|
||||
gfx_fill_rect_inset(dpi, graphLeft, graphTop, graphRight, graphBottom, w->colours[1], INSET_RECT_F_30);
|
||||
@@ -863,7 +859,7 @@ static void window_finances_park_value_graph_paint(rct_window* w, rct_drawpixeli
|
||||
money32 axisValue = axisBase << yAxisScale;
|
||||
auto ft = Formatter();
|
||||
ft.Add<money32>(axisValue);
|
||||
DrawTextBasic(dpi, { x + 70, y }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, COLOUR_BLACK, TextAlignment::RIGHT);
|
||||
DrawTextBasic(dpi, { x + 70, y }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, { TextAlignment::RIGHT });
|
||||
gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
|
||||
y += 39;
|
||||
}
|
||||
@@ -936,9 +932,9 @@ static void window_finances_profit_graph_paint(rct_window* w, rct_drawpixelinfo*
|
||||
|
||||
// Weekly profit
|
||||
money32 weeklyPofit = gCurrentProfit;
|
||||
gfx_draw_string_left(
|
||||
dpi, weeklyPofit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS, &weeklyPofit,
|
||||
COLOUR_BLACK, { graphLeft, graphTop - 11 });
|
||||
DrawTextBasic(
|
||||
dpi, { graphLeft, graphTop - 11 },
|
||||
weeklyPofit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS, &weeklyPofit);
|
||||
|
||||
// Graph
|
||||
gfx_fill_rect_inset(dpi, graphLeft, graphTop, graphRight, graphBottom, w->colours[1], INSET_RECT_F_30);
|
||||
@@ -969,8 +965,7 @@ static void window_finances_profit_graph_paint(rct_window* w, rct_drawpixelinfo*
|
||||
auto ft = Formatter();
|
||||
ft.Add<money32>(axisValue);
|
||||
DrawTextBasic(
|
||||
dpi, screenPos + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, COLOUR_BLACK,
|
||||
TextAlignment::RIGHT);
|
||||
dpi, screenPos + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, { TextAlignment::RIGHT });
|
||||
gfx_fill_rect_inset(
|
||||
dpi, screenPos.x + 70, screenPos.y + 5, graphLeft + 482, screenPos.y + 5, w->colours[2],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
@@ -1104,20 +1099,20 @@ static void window_finances_marketing_paint(rct_window* w, rct_drawpixelinfo* dp
|
||||
}
|
||||
|
||||
// Advertisement
|
||||
DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, 296, MarketingCampaignNames[i][1], ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, 296, MarketingCampaignNames[i][1], ft);
|
||||
|
||||
// Duration
|
||||
uint16_t weeksRemaining = campaign->WeeksLeft;
|
||||
gfx_draw_string_left(
|
||||
dpi, weeksRemaining == 1 ? STR_1_WEEK_REMAINING : STR_X_WEEKS_REMAINING, &weeksRemaining, COLOUR_BLACK,
|
||||
screenCoords + ScreenCoordsXY{ 304, 0 });
|
||||
DrawTextBasic(
|
||||
dpi, screenCoords + ScreenCoordsXY{ 304, 0 }, weeksRemaining == 1 ? STR_1_WEEK_REMAINING : STR_X_WEEKS_REMAINING,
|
||||
&weeksRemaining);
|
||||
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
if (noCampaignsActive)
|
||||
{
|
||||
gfx_draw_string_left(dpi, STR_MARKETING_CAMPAIGNS_NONE, nullptr, COLOUR_BLACK, screenCoords + ScreenCoordsXY{ 4, 0 });
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, STR_MARKETING_CAMPAIGNS_NONE);
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
}
|
||||
screenCoords.y += 34;
|
||||
@@ -1130,10 +1125,8 @@ static void window_finances_marketing_paint(rct_window* w, rct_drawpixelinfo* dp
|
||||
{
|
||||
// Draw button text
|
||||
money32 pricePerWeek = AdvertisingCampaignPricePerWeek[i];
|
||||
gfx_draw_string_left(
|
||||
dpi, MarketingCampaignNames[i][0], nullptr, COLOUR_BLACK, screenCoords + ScreenCoordsXY{ 4, 0 });
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_MARKETING_PER_WEEK, &pricePerWeek, COLOUR_BLACK, screenCoords + ScreenCoordsXY{ WH_SUMMARY, 0 });
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, MarketingCampaignNames[i][0]);
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ WH_SUMMARY, 0 }, STR_MARKETING_PER_WEEK, &pricePerWeek);
|
||||
|
||||
screenCoords.y += BUTTON_FACE_HEIGHT + 2;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user