1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Create widget type for horizontal separator

This commit is contained in:
Gymnasiast
2025-03-17 21:47:05 +01:00
parent e06832693b
commit 835f45523d
5 changed files with 24 additions and 10 deletions

View File

@@ -1106,6 +1106,7 @@ namespace OpenRCT2
case WindowWidgetType::Groupbox:
case WindowWidgetType::ProgressBar:
case WindowWidgetType::Placeholder:
case WindowWidgetType::HorizontalSeparator:
// Non-interactive widget type
break;
case WindowWidgetType::ImgBtn:

View File

@@ -39,6 +39,7 @@ namespace OpenRCT2::Ui
static void WidgetTextInset(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widgetIndex);
static void WidgetTextBoxDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widgetIndex);
static void WidgetProgressBarDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widgetIndex);
static void WidgetHorizontalSeparatorDraw(DrawPixelInfo& dpi, WindowBase& w, const Widget& widget);
static void WidgetGroupboxDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widgetIndex);
static void WidgetCaptionDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widgetIndex);
static void WidgetCheckboxDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widgetIndex);
@@ -118,6 +119,9 @@ namespace OpenRCT2::Ui
case WindowWidgetType::ProgressBar:
WidgetProgressBarDraw(dpi, w, widgetIndex);
break;
case WindowWidgetType::HorizontalSeparator:
WidgetHorizontalSeparatorDraw(dpi, w, *widget);
break;
default:
break;
}
@@ -1210,6 +1214,14 @@ namespace OpenRCT2::Ui
}
}
static void WidgetHorizontalSeparatorDraw(DrawPixelInfo& dpi, WindowBase& w, const Widget& widget)
{
ScreenCoordsXY topLeft{ w.windowPos + ScreenCoordsXY{ widget.left, widget.top } };
ScreenCoordsXY bottomRight{ w.windowPos + ScreenCoordsXY{ widget.right, widget.bottom } };
GfxFillRectInset(dpi, { topLeft, bottomRight }, w.colours[1], INSET_RECT_FLAG_BORDER_INSET);
}
ImageId GetColourButtonImage(colour_t colour)
{
if (colour == COLOUR_INVISIBLE)

View File

@@ -113,6 +113,8 @@ namespace OpenRCT2::Scripting
return "placeholder";
case WindowWidgetType::ProgressBar:
return "progress_bar";
case WindowWidgetType::HorizontalSeparator:
return "horizontal_separator";
case WindowWidgetType::Custom:
return "custom";
}

View File

@@ -97,6 +97,7 @@ namespace OpenRCT2::Ui::Windows
WIDX_NAUSEA_BAR,
WIDX_TOILET_LABEL,
WIDX_TOILET_BAR,
WIDX_SEPARATOR,
WIDX_RIDES_BEEN_ON_LABEL = WIDX_TAB_CONTENT_START,
WIDX_RIDE_SCROLL,
@@ -135,18 +136,19 @@ namespace OpenRCT2::Ui::Windows
static constexpr Widget _guestWindowWidgetsStats[] = {
MAIN_GUEST_WIDGETS,
MakeWidget ({ 3, (kListRowHeight * 0) + 4 + 43 }, { 62, 10}, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_HAPPINESS_LABEL),
MakeWidget ({ 3, (kListRowHeight * 0) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_HAPPINESS_LABEL),
MakeProgressBar({ 65, (kListRowHeight * 0) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_GREEN, 0, 19),
MakeWidget ({ 3, (kListRowHeight * 1) + 4 + 43 }, { 62, 10}, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_ENERGY_LABEL),
MakeWidget ({ 3, (kListRowHeight * 1) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_ENERGY_LABEL),
MakeProgressBar({ 65, (kListRowHeight * 1) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_GREEN, 0, 19),
MakeWidget ({ 3, (kListRowHeight * 2) + 4 + 43 }, { 62, 10}, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_HUNGER_LABEL),
MakeWidget ({ 3, (kListRowHeight * 2) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_HUNGER_LABEL),
MakeProgressBar({ 65, (kListRowHeight * 2) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 67, 100),
MakeWidget ({ 3, (kListRowHeight * 3) + 4 + 43 }, { 62, 10}, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_THIRST_LABEL),
MakeWidget ({ 3, (kListRowHeight * 3) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_THIRST_LABEL),
MakeProgressBar({ 65, (kListRowHeight * 3) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 67, 100),
MakeWidget ({ 3, (kListRowHeight * 4) + 4 + 43 }, { 62, 10}, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_NAUSEA_LABEL),
MakeWidget ({ 3, (kListRowHeight * 4) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_NAUSEA_LABEL),
MakeProgressBar({ 65, (kListRowHeight * 4) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 47, 100),
MakeWidget ({ 3, (kListRowHeight * 5) + 4 + 43 }, { 62, 10}, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_TOILET_LABEL),
MakeWidget ({ 3, (kListRowHeight * 5) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_TOILET_LABEL),
MakeProgressBar({ 65, (kListRowHeight * 5) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 62, 100),
MakeWidget ({ 3, (kListRowHeight * 7) + 9 + 43 }, { 180, 2 }, WindowWidgetType::HorizontalSeparator, WindowColour::Secondary),
};
static constexpr Widget _guestWindowWidgetsRides[] = {
@@ -1139,11 +1141,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_TIME_IN_PARK, ft);
}
// Horizontal separator
screenCoords.y += kListRowHeight + 9;
GfxFillRectInset(
dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 179, -5 } }, colours[1],
INSET_RECT_FLAG_BORDER_INSET);
// Preferred Ride
DrawTextBasic(dpi, screenCoords, STR_GUEST_STAT_PREFERRED_RIDE);

View File

@@ -47,6 +47,7 @@ namespace OpenRCT2
ProgressBar = 29,
Custom = 28,
TextBox = 27,
HorizontalSeparator = 30,
};
using WidgetFlags = uint32_t;