Part of #11569: Use gfx_draw_string_right with ScreenCoordsXY

This commit is contained in:
Tulio Leao 2020-06-11 09:38:02 -03:00
parent 1ea1d24f00
commit fab0ea131f
12 changed files with 30 additions and 32 deletions

View File

@ -650,13 +650,13 @@ void CustomListView::PaintHeading(
{
auto ft = Formatter::Common();
ft.Add<rct_string_id>(STR_UP);
gfx_draw_string_right(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, pos.x + size.width - 1, pos.y);
gfx_draw_string_right(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, { pos.x + size.width - 1, pos.y });
}
else if (sortOrder == ColumnSortOrder::Descending)
{
auto ft = Formatter::Common();
ft.Add<rct_string_id>(STR_DOWN);
gfx_draw_string_right(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, pos.x + size.width - 1, pos.y);
gfx_draw_string_right(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, { pos.x + size.width - 1, pos.y });
}
}

View File

@ -1216,14 +1216,14 @@ static void window_cheats_paint(rct_window* w, rct_drawpixelinfo* dpi)
gfx_draw_string_left(
dpi, STR_DAY, nullptr, COLOUR_BLACK, w->windowPos.x + XPL(0) + TXTO, w->windowPos.y + YPL(9) + TXTO);
gfx_draw_string_right(
dpi, STR_FORMAT_INTEGER, &_yearSpinnerValue, w->colours[1], w->windowPos.x + WPL(1) - 34 - TXTO,
w->windowPos.y + YPL(7) + TXTO);
dpi, STR_FORMAT_INTEGER, &_yearSpinnerValue, w->colours[1],
{ w->windowPos.x + WPL(1) - 34 - TXTO, w->windowPos.y + YPL(7) + TXTO });
gfx_draw_string_right(
dpi, STR_FORMAT_MONTH, &actual_month, w->colours[1], w->windowPos.x + WPL(1) - 34 - TXTO,
w->windowPos.y + YPL(8) + TXTO);
dpi, STR_FORMAT_MONTH, &actual_month, w->colours[1],
{ w->windowPos.x + WPL(1) - 34 - TXTO, w->windowPos.y + YPL(8) + TXTO });
gfx_draw_string_right(
dpi, STR_FORMAT_INTEGER, &_daySpinnerValue, w->colours[1], w->windowPos.x + WPL(1) - 34 - TXTO,
w->windowPos.y + YPL(9) + TXTO);
dpi, STR_FORMAT_INTEGER, &_daySpinnerValue, w->colours[1],
{ w->windowPos.x + WPL(1) - 34 - TXTO, w->windowPos.y + YPL(9) + TXTO });
}
else if (w->page == WINDOW_CHEATS_PAGE_MISC)
{
@ -1232,8 +1232,8 @@ static void window_cheats_paint(rct_window* w, rct_drawpixelinfo* dpi)
gfx_draw_string_left(
dpi, STR_FORCE_WEATHER, nullptr, COLOUR_BLACK, w->windowPos.x + XPL(0) + TXTO, w->windowPos.y + YPL(10) + TXTO);
gfx_draw_string_right(
dpi, STR_FORMAT_INTEGER, &_parkRatingSpinnerValue, w->colours[1], w->windowPos.x + WPL(1) - 34 - TXTO,
w->windowPos.y + YPL(5) + TXTO);
dpi, STR_FORMAT_INTEGER, &_parkRatingSpinnerValue, w->colours[1],
{ w->windowPos.x + WPL(1) - 34 - TXTO, w->windowPos.y + YPL(5) + TXTO });
}
else if (w->page == WINDOW_CHEATS_PAGE_GUESTS)
{

View File

@ -1092,14 +1092,14 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
if (get_selected_object_type(w) == OBJECT_TYPE_RIDE)
{
stringId = get_ride_type_string_id(listItem->repositoryItem);
gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, w->windowPos.x + w->width - 5, y);
gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, { w->windowPos.x + w->width - 5, y });
}
y += 12;
// Draw object source
stringId = object_manager_get_source_game_string(listItem->repositoryItem->GetFirstSourceGame());
gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, w->windowPos.x + w->width - 5, y);
gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, { w->windowPos.x + w->width - 5, y });
y += 12;
// Draw object dat name
@ -1107,7 +1107,8 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
ft = Formatter::Common();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<const char*>(path);
gfx_draw_string_right(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + w->width - 5, y);
gfx_draw_string_right(
dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, { w->windowPos.x + w->width - 5, y });
}
/**

View File

@ -887,7 +887,7 @@ static void window_finances_financial_graph_paint(rct_window* w, rct_drawpixelin
for (axisBase = MONEY(12, 00); axisBase >= MONEY(-12, 00); axisBase -= MONEY(6, 00))
{
money32 axisValue = axisBase << yAxisScale;
gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, x + 70, y);
gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, { x + 70, y });
gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
y += 39;
}
@ -990,7 +990,7 @@ static void window_finances_park_value_graph_paint(rct_window* w, rct_drawpixeli
for (axisBase = MONEY(24, 00); axisBase >= MONEY(0, 00); axisBase -= MONEY(6, 00))
{
money32 axisValue = axisBase << yAxisScale;
gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, x + 70, y);
gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, { x + 70, y });
gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
y += 39;
}
@ -1094,7 +1094,7 @@ static void window_finances_profit_graph_paint(rct_window* w, rct_drawpixelinfo*
for (axisBase = MONEY(12, 00); axisBase >= MONEY(-12, 00); axisBase -= MONEY(6, 00))
{
money32 axisValue = axisBase << yAxisScale;
gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, x + 70, y);
gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, { x + 70, y });
gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
y += 39;
}

View File

@ -852,7 +852,7 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
auto ft = Formatter::Common();
ft.Add<rct_string_id>(STR_GUESTS_COUNT_COMMA_SEP);
ft.Add<uint32_t>(numGuests);
gfx_draw_string_right(dpi, format, gCommonFormatArgs, COLOUR_BLACK, 326, y);
gfx_draw_string_right(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { 326, y });
}
y += SUMMARISED_GUEST_ROW_HEIGHT;
}

View File

@ -1027,7 +1027,7 @@ static void window_new_ride_paint_ride_information(
if (!ride_type_has_flag(item.Type, RIDE_TYPE_FLAG_HAS_NO_TRACK))
stringId = STR_NEW_RIDE_COST_FROM;
gfx_draw_string_right(dpi, stringId, &price, COLOUR_BLACK, x + width, y + 51);
gfx_draw_string_right(dpi, stringId, &price, COLOUR_BLACK, { x + width, y + 51 });
}
}

View File

@ -1064,7 +1064,7 @@ static void window_park_rating_paint(rct_window* w, rct_drawpixelinfo* dpi)
for (int i = 5; i >= 0; i--)
{
uint32_t axisValue = i * 200;
gfx_draw_string_right(dpi, STR_GRAPH_AXIS_LABEL, &axisValue, COLOUR_BLACK, x + 10, y);
gfx_draw_string_right(dpi, STR_GRAPH_AXIS_LABEL, &axisValue, COLOUR_BLACK, { x + 10, y });
gfx_fill_rect_inset(dpi, x + 15, y + 5, x + w->width - 32, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
y += 20;
}
@ -1195,7 +1195,7 @@ static void window_park_guests_paint(rct_window* w, rct_drawpixelinfo* dpi)
for (int i = 5; i >= 0; i--)
{
uint32_t axisValue = i * 1000;
gfx_draw_string_right(dpi, STR_GRAPH_AXIS_LABEL, &axisValue, COLOUR_BLACK, x + 10, y);
gfx_draw_string_right(dpi, STR_GRAPH_AXIS_LABEL, &axisValue, COLOUR_BLACK, { x + 10, y });
gfx_fill_rect_inset(dpi, x + 15, y + 5, x + w->width - 32, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
y += 20;
}

View File

@ -1180,8 +1180,8 @@ void window_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi)
// -14
gfx_draw_string_right(
dpi, STR_COST_LABEL, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + w->width - 0x1A,
w->windowPos.y + w->height - 13);
dpi, STR_COST_LABEL, gCommonFormatArgs, COLOUR_BLACK,
{ w->windowPos.x + w->width - 0x1A, w->windowPos.y + w->height - 13 });
}
auto ft = Formatter::Common();

View File

@ -1790,8 +1790,10 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
if (windowTileInspectorTileSelected)
{
auto tileCoords = TileCoordsXY{ windowTileInspectorToolMap };
gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &tileCoords.x, COLOUR_WHITE, w->windowPos.x + 43, w->windowPos.y + 24);
gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &tileCoords.y, COLOUR_WHITE, w->windowPos.x + 113, w->windowPos.y + 24);
gfx_draw_string_right(
dpi, STR_FORMAT_INTEGER, &tileCoords.x, COLOUR_WHITE, { w->windowPos.x + 43, w->windowPos.y + 24 });
gfx_draw_string_right(
dpi, STR_FORMAT_INTEGER, &tileCoords.y, COLOUR_WHITE, { w->windowPos.x + 113, w->windowPos.y + 24 });
}
else
{

View File

@ -892,7 +892,8 @@ static void window_top_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
if (gCheatsDisableClearanceChecks)
{
gfx_draw_string_right(
dpi, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, nullptr, COLOUR_DARK_ORANGE | COLOUR_FLAG_OUTLINE, x + 26, y + 2);
dpi, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, nullptr, COLOUR_DARK_ORANGE | COLOUR_FLAG_OUTLINE,
{ x + 26, y + 2 });
}
}
@ -966,7 +967,7 @@ static void window_top_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Draw number of players.
int32_t player_count = network_get_num_players();
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_draw_string_right(dpi, STR_COMMA16, &player_count, COLOUR_WHITE | COLOUR_FLAG_OUTLINE, x + 23, y + 1);
gfx_draw_string_right(dpi, STR_COMMA16, &player_count, COLOUR_WHITE | COLOUR_FLAG_OUTLINE, { x + 23, y + 1 });
}
}

View File

@ -648,7 +648,6 @@ void gfx_draw_string_centred(
rct_drawpixelinfo* dpi, rct_string_id format, const ScreenCoordsXY& coords, uint8_t colour, const void* args);
void gfx_draw_string_right(
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords);
void gfx_draw_string_right(rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, int32_t x, int32_t y);
void draw_string_left_underline(
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords);

View File

@ -162,11 +162,6 @@ void gfx_draw_string_centred(
DrawTextCompat(dpi, coords.x, coords.y, format, args, colour, TextAlignment::CENTRE);
}
void gfx_draw_string_right(rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, int32_t x, int32_t y)
{
gfx_draw_string_right(dpi, format, args, colour, { x, y });
}
void gfx_draw_string_right(
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords)
{