forked from rosebudai/OpenRCT2-Web
Part of #11564: gfx_draw_string_centred_clipped with ScreenCoordsXY
This commit is contained in:
1 parent
ce171164c9
commit
613cec3f7a
14 files changed
+31
-28
No files matched your search
@@ -369,7 +369,7 @@ static void widget_text_centred(rct_drawpixelinfo* dpi, rct_window* w, rct_widge
|
||||
formatArgs = &widget->string;
|
||||
}
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, stringId, formatArgs, colour, (l + r + 1) / 2 - 1, t, widget->right - widget->left - 2);
|
||||
dpi, stringId, formatArgs, colour, { (l + r + 1) / 2 - 1, t }, widget->right - widget->left - 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -565,7 +565,7 @@ static void widget_caption_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widge
|
||||
width -= 10;
|
||||
}
|
||||
l += width / 2;
|
||||
gfx_draw_string_centred_clipped(dpi, widget->text, gCommonFormatArgs, COLOUR_WHITE | COLOUR_FLAG_OUTLINE, l, t, width);
|
||||
gfx_draw_string_centred_clipped(dpi, widget->text, gCommonFormatArgs, COLOUR_WHITE | COLOUR_FLAG_OUTLINE, { l, t }, width);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -605,7 +605,7 @@ static void widget_closebox_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widg
|
||||
if (widget_is_disabled(w, widgetIndex))
|
||||
colour |= COLOUR_FLAG_INSET;
|
||||
|
||||
gfx_draw_string_centred_clipped(dpi, widget->text, gCommonFormatArgs, colour, l, t, widget->right - widget->left - 2);
|
||||
gfx_draw_string_centred_clipped(dpi, widget->text, gCommonFormatArgs, colour, { l, t }, widget->right - widget->left - 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -612,7 +612,7 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
|
||||
width = w->width - w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right - 6;
|
||||
|
||||
rct_string_id drawString = window_editor_inventions_list_prepare_name(researchItem, false);
|
||||
gfx_draw_string_centred_clipped(dpi, drawString, gCommonFormatArgs, COLOUR_BLACK, x, y, width);
|
||||
gfx_draw_string_centred_clipped(dpi, drawString, gCommonFormatArgs, COLOUR_BLACK, { x, y }, width);
|
||||
y += 15;
|
||||
|
||||
// Item category
|
||||
|
||||
@@ -1067,7 +1067,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(listItem->repositoryItem->Name.c_str());
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, screenPos.x, screenPos.y, width);
|
||||
dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, screenPos, width);
|
||||
}
|
||||
|
||||
// Draw description of object
|
||||
|
||||
@@ -1088,7 +1088,7 @@ void window_guest_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
int32_t x = (widget->left + widget->right) / 2 + w->windowPos.x;
|
||||
int32_t y = w->windowPos.y + widget->top - 1;
|
||||
int32_t width = widget->right - widget->left;
|
||||
gfx_draw_string_centred_clipped(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, x, y, width);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, { x, y }, width);
|
||||
|
||||
// Draw the marquee thought
|
||||
widget = &w->widgets[WIDX_MARQUEE];
|
||||
|
||||
@@ -250,7 +250,7 @@ static void window_install_track_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
// Scenery not available
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, nullptr, COLOUR_BLACK, x, y, 368);
|
||||
dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, nullptr, COLOUR_BLACK, { x, y }, 368);
|
||||
y -= LIST_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -917,8 +917,9 @@ static void window_multiplayer_groups_paint(rct_window* w, rct_drawpixelinfo* dp
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<const char*>(buffer);
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, STR_STRING, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + (widget->left + widget->right - 11) / 2,
|
||||
w->windowPos.y + widget->top, widget->right - widget->left - 8);
|
||||
dpi, STR_STRING, gCommonFormatArgs, COLOUR_BLACK,
|
||||
w->windowPos + ScreenCoordsXY{ (widget->left + widget->right - 11) / 2, widget->top },
|
||||
widget->right - widget->left - 8);
|
||||
}
|
||||
|
||||
int32_t x = w->windowPos.x + window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].left + 4;
|
||||
@@ -942,8 +943,9 @@ static void window_multiplayer_groups_paint(rct_window* w, rct_drawpixelinfo* dp
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<const char*>(buffer);
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, STR_STRING, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + (widget->left + widget->right - 11) / 2,
|
||||
w->windowPos.y + widget->top, widget->right - widget->left - 8);
|
||||
dpi, STR_STRING, gCommonFormatArgs, COLOUR_BLACK,
|
||||
w->windowPos + ScreenCoordsXY{ (widget->left + widget->right - 11) / 2, widget->top },
|
||||
widget->right - widget->left - 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -876,8 +876,9 @@ static void window_park_entrance_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
labelWidget = &window_park_entrance_widgets[WIDX_STATUS];
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + (labelWidget->left + labelWidget->right) / 2,
|
||||
w->windowPos.y + labelWidget->top, labelWidget->right - labelWidget->left);
|
||||
dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK,
|
||||
w->windowPos + ScreenCoordsXY{ (labelWidget->left + labelWidget->right) / 2, labelWidget->top },
|
||||
labelWidget->right - labelWidget->left);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -378,8 +378,9 @@ void window_player_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
ft.Add<const char*>(buffer);
|
||||
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, STR_STRING, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + (widget->left + widget->right - 11) / 2,
|
||||
w->windowPos.y + widget->top, widget->right - widget->left - 8);
|
||||
dpi, STR_STRING, gCommonFormatArgs, COLOUR_BLACK,
|
||||
w->windowPos + ScreenCoordsXY{ (widget->left + widget->right - 11) / 2, widget->top },
|
||||
widget->right - widget->left - 8);
|
||||
}
|
||||
|
||||
// Draw ping
|
||||
@@ -405,8 +406,7 @@ void window_player_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_ACTION_NA);
|
||||
}
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, STR_LAST_ACTION_RAN, gCommonFormatArgs, COLOUR_BLACK, screenCoords.x, screenCoords.y, width);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_LAST_ACTION_RAN, gCommonFormatArgs, COLOUR_BLACK, screenCoords, width);
|
||||
|
||||
if (w->viewport != nullptr && w->var_492 != -1)
|
||||
{
|
||||
|
||||
@@ -2930,8 +2930,8 @@ static void window_ride_main_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
widget = &window_ride_main_widgets[WIDX_STATUS];
|
||||
rct_string_id ride_status = window_ride_get_status(w, gCommonFormatArgs);
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, ride_status, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + (widget->left + widget->right) / 2,
|
||||
w->windowPos.y + widget->top, widget->right - widget->left);
|
||||
dpi, ride_status, gCommonFormatArgs, COLOUR_BLACK,
|
||||
w->windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top }, widget->right - widget->left);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -951,7 +951,7 @@ void window_staff_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
int32_t x = (widget->left + widget->right) / 2 + w->windowPos.x;
|
||||
int32_t y = w->windowPos.y + widget->top;
|
||||
int32_t width = widget->right - widget->left;
|
||||
gfx_draw_string_centred_clipped(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, x, y, width);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, { x, y }, width);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -475,7 +475,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
// Show locked information
|
||||
int32_t x = w->windowPos.x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
|
||||
int32_t y = w->windowPos.y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
|
||||
gfx_draw_string_centred_clipped(dpi, STR_SCENARIO_LOCKED, nullptr, COLOUR_BLACK, x + 85, y, 170);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_SCENARIO_LOCKED, nullptr, COLOUR_BLACK, { x + 85, y }, 170);
|
||||
y += 15;
|
||||
y += gfx_draw_string_left_wrapped(dpi, nullptr, x, y, 170, STR_SCENARIO_LOCKED_DESC, COLOUR_BLACK) + 5;
|
||||
}
|
||||
@@ -502,7 +502,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(scenario->name);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, x + 85, y, 170);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, { x + 85, y }, 170);
|
||||
y += 15;
|
||||
|
||||
// Scenario details
|
||||
|
||||
@@ -560,7 +560,7 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
&& !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
|
||||
{
|
||||
// Vehicle design not available
|
||||
gfx_draw_string_centred_clipped(dpi, STR_VEHICLE_DESIGN_UNAVAILABLE, nullptr, COLOUR_BLACK, x, y, 368);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_VEHICLE_DESIGN_UNAVAILABLE, nullptr, COLOUR_BLACK, { x, y }, 368);
|
||||
y -= SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
@@ -570,14 +570,14 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
// Scenery not available
|
||||
gfx_draw_string_centred_clipped(
|
||||
dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, nullptr, COLOUR_BLACK, x, y, 368);
|
||||
dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, nullptr, COLOUR_BLACK, { x, y }, 368);
|
||||
y -= SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
// Track design name
|
||||
utf8* trackName = _trackDesigns[trackIndex].name;
|
||||
gfx_draw_string_centred_clipped(dpi, STR_TRACK_PREVIEW_NAME_FORMAT, &trackName, COLOUR_BLACK, x, y, 368);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_TRACK_PREVIEW_NAME_FORMAT, &trackName, COLOUR_BLACK, { x, y }, 368);
|
||||
|
||||
// Information
|
||||
x = w->windowPos.x + widget->left + 1;
|
||||
|
||||
@@ -659,7 +659,7 @@ void draw_string_right_underline(
|
||||
void gfx_draw_string_left_clipped(
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords, int32_t width);
|
||||
void gfx_draw_string_centred_clipped(
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, int32_t x, int32_t y, int32_t width);
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords, int32_t width);
|
||||
void gfx_draw_string_right_clipped(
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords, int32_t width);
|
||||
|
||||
|
||||
@@ -194,9 +194,9 @@ void gfx_draw_string_left_clipped(
|
||||
}
|
||||
|
||||
void gfx_draw_string_centred_clipped(
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, int32_t x, int32_t y, int32_t width)
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords, int32_t width)
|
||||
{
|
||||
DrawTextEllipsisedCompat(dpi, x, y, width, format, args, colour, TextAlignment::CENTRE);
|
||||
DrawTextEllipsisedCompat(dpi, coords.x, coords.y, width, format, args, colour, TextAlignment::CENTRE);
|
||||
}
|
||||
|
||||
void gfx_draw_string_right_clipped(
|
||||
|
||||
Reference in new issue
Block a user