diff --git a/src/openrct2-ui/interface/Graph.cpp b/src/openrct2-ui/interface/Graph.cpp index 4e4d53bded..d17efece3f 100644 --- a/src/openrct2-ui/interface/Graph.cpp +++ b/src/openrct2-ui/interface/Graph.cpp @@ -17,6 +17,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Graph { constexpr int32_t kDashLength = 2; @@ -38,13 +40,13 @@ namespace OpenRCT2::Graph rt, { internalBounds.GetLeft() - kYTickMarkPadding, curScreenPos }, { FontStyle::Small, TextAlignment::RIGHT }, buffer); // Draw Y label tick mark - GfxFillRect( + Rect::fill( rt, { { internalBounds.GetLeft() - 5, curScreenPos + 5 }, { internalBounds.GetLeft(), curScreenPos + 5 } }, PaletteIndex::pi10); // Draw horizontal gridline - GfxFillRectInset( + Rect::fillInset( rt, { { internalBounds.GetLeft(), curScreenPos + 5 }, { internalBounds.GetRight(), curScreenPos + 5 } }, - lineCol, RectBorderStyle::inset); + lineCol, Rect::BorderStyle::inset); curScreenPos += yLabelStepPx; curLabel -= yLabelStep; } @@ -69,7 +71,7 @@ namespace OpenRCT2::Graph rt, screenCoords - ScreenCoordsXY{ 0, 14 }, STR_GRAPH_LABEL, ft, { FontStyle::Small, TextAlignment::CENTRE }); // Draw month tick mark - GfxFillRect( + Rect::fill( rt, { screenCoords - ScreenCoordsXY{ 0, 4 }, screenCoords - ScreenCoordsXY{ 0, 1 } }, PaletteIndex::pi10); } @@ -100,8 +102,8 @@ namespace OpenRCT2::Graph DrawText(rt, coords - ScreenCoordsXY{ 0, 16 }, { textCol, TextAlignment::CENTRE }, text); - GfxFillRect(rt, { { coords - ScreenCoordsXY{ 2, 2 } }, coords + ScreenCoordsXY{ 2, 2 } }, PaletteIndex::pi10); - GfxFillRect(rt, { { coords - ScreenCoordsXY{ 1, 1 } }, { coords + ScreenCoordsXY{ 1, 1 } } }, PaletteIndex::pi21); + Rect::fill(rt, { { coords - ScreenCoordsXY{ 2, 2 } }, coords + ScreenCoordsXY{ 2, 2 } }, PaletteIndex::pi10); + Rect::fill(rt, { { coords - ScreenCoordsXY{ 1, 1 } }, { coords + ScreenCoordsXY{ 1, 1 } } }, PaletteIndex::pi21); } template @@ -135,7 +137,7 @@ namespace OpenRCT2::Graph } if (i == 0) { - GfxFillRect(rt, { coords, coords + ScreenCoordsXY{ 2, 2 } }, PaletteIndex::pi10); + Rect::fill(rt, { coords, coords + ScreenCoordsXY{ 2, 2 } }, PaletteIndex::pi10); } } else @@ -148,7 +150,7 @@ namespace OpenRCT2::Graph } if (i == 0) { - GfxFillRect( + Rect::fill( rt, { coords - ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 1, 1 } }, PaletteIndex::pi21); } } diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index bcfd50ed1c..85839c07ca 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -28,6 +28,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Ui; static InGameConsole _inGameConsole; @@ -311,20 +312,20 @@ void InGameConsole::Draw(RenderTarget& rt) const Invalidate(); // Give console area a translucent effect. - GfxFilterRect(rt, { _consoleTopLeft, _consoleBottomRight }, FilterPaletteID::palette51); + Rect::filter(rt, { _consoleTopLeft, _consoleBottomRight }, FilterPaletteID::palette51); // Make input area more opaque. - GfxFilterRect( + Rect::filter( rt, { { _consoleTopLeft.x, _consoleBottomRight.y - lineHeight - 10 }, _consoleBottomRight - ScreenCoordsXY{ 0, 1 } }, FilterPaletteID::palette51); // Paint background colour. auto backgroundColour = ThemeGetColour(WindowClass::console, 0); - GfxFillRectInset( - rt, { _consoleTopLeft, _consoleBottomRight }, backgroundColour, RectBorderStyle::outset, INSET_RECT_FLAG_FILL_NONE); - GfxFillRectInset( + Rect::fillInset( + rt, { _consoleTopLeft, _consoleBottomRight }, backgroundColour, Rect::BorderStyle::outset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset( rt, { _consoleTopLeft + ScreenCoordsXY{ 1, 1 }, _consoleBottomRight - ScreenCoordsXY{ 1, 1 } }, backgroundColour, - RectBorderStyle::inset); + Rect::BorderStyle::inset); std::string lineBuffer; auto screenCoords = _consoleTopLeft + ScreenCoordsXY{ kConsoleEdgePadding, kConsoleEdgePadding }; @@ -375,7 +376,7 @@ void InGameConsole::Draw(RenderTarget& rt) const { auto caret = screenCoords + ScreenCoordsXY{ _caretScreenPosX, lineHeight }; uint8_t caretColour = ColourMapA[textColour.colour].lightest; - GfxFillRect(rt, { caret, caret + ScreenCoordsXY{ kConsoleCaretWidth, 1 } }, caretColour); + Rect::fill(rt, { caret, caret + ScreenCoordsXY{ kConsoleCaretWidth, 1 } }, caretColour); } // What about border colours? @@ -383,22 +384,22 @@ void InGameConsole::Draw(RenderTarget& rt) const uint8_t borderColour2 = ColourMapA[backgroundColour.colour].mid_dark; // Input area top border - GfxFillRect( + Rect::fill( rt, { { _consoleTopLeft.x, _consoleBottomRight.y - lineHeight - 11 }, { _consoleBottomRight.x, _consoleBottomRight.y - lineHeight - 11 } }, borderColour1); - GfxFillRect( + Rect::fill( rt, { { _consoleTopLeft.x, _consoleBottomRight.y - lineHeight - 10 }, { _consoleBottomRight.x, _consoleBottomRight.y - lineHeight - 10 } }, borderColour2); // Input area bottom border - GfxFillRect( + Rect::fill( rt, { { _consoleTopLeft.x, _consoleBottomRight.y - 1 }, { _consoleBottomRight.x, _consoleBottomRight.y - 1 } }, borderColour1); - GfxFillRect(rt, { { _consoleTopLeft.x, _consoleBottomRight.y }, _consoleBottomRight }, borderColour2); + Rect::fill(rt, { { _consoleTopLeft.x, _consoleBottomRight.y }, _consoleBottomRight }, borderColour2); } // Calculates the amount of visible lines, based on the console size, excluding the input line. diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 89c6d5234a..698f82e07b 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -26,6 +26,7 @@ #include using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; namespace OpenRCT2::Ui { @@ -149,7 +150,7 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget.colour]; // Draw the frame - GfxFillRectInset(rt, { leftTop, { r, b } }, colour, RectBorderStyle::outset, press); + Rect::fillInset(rt, { leftTop, { r, b } }, colour, Rect::BorderStyle::outset, press); if (!w.canBeResized()) return; @@ -176,7 +177,7 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget.colour]; // Draw the panel - GfxFillRectInset(rt, { leftTop, { r, b } }, colour); + Rect::fillInset(rt, { leftTop, { r, b } }, colour); if (!w.canBeResized()) return; @@ -200,8 +201,8 @@ namespace OpenRCT2::Ui w.windowPos + ScreenCoordsXY{ widget.right, widget.bottom } }; // Check if the button is pressed down - auto borderStyle = widgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex) ? RectBorderStyle::inset - : RectBorderStyle::outset; + auto borderStyle = widgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex) ? Rect::BorderStyle::inset + : Rect::BorderStyle::outset; auto colour = w.colours[widget.colour]; @@ -209,12 +210,12 @@ namespace OpenRCT2::Ui if (static_cast(widget.image.GetIndex()) == -2) { // Draw border with no fill - GfxFillRectInset(rt, rect, colour, borderStyle, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, rect, colour, borderStyle, INSET_RECT_FLAG_FILL_NONE); return; } // Draw the border with fill - GfxFillRectInset(rt, rect, colour, borderStyle); + Rect::fillInset(rt, rect, colour, borderStyle); WidgetDrawImage(rt, w, widgetIndex); } @@ -296,12 +297,12 @@ namespace OpenRCT2::Ui if (static_cast(widget.image.GetIndex()) == -2) { // Draw border with no fill - GfxFillRectInset(rt, rect, colour, RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, rect, colour, Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); return; } // Draw the border with fill - GfxFillRectInset(rt, rect, colour, RectBorderStyle::inset); + Rect::fillInset(rt, rect, colour, Rect::BorderStyle::inset); } // Draw image @@ -324,9 +325,9 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget.colour]; // Border - auto borderStyle = widgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex) ? RectBorderStyle::inset - : RectBorderStyle::outset; - GfxFillRectInset(rt, rect, colour, borderStyle); + auto borderStyle = widgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex) ? Rect::BorderStyle::inset + : Rect::BorderStyle::outset; + Rect::fillInset(rt, rect, colour, borderStyle); // Button caption if (widget.type != WidgetType::tableHeader) @@ -447,7 +448,7 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget.colour]; - GfxFillRectInset(rt, rect, colour, RectBorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); + Rect::fillInset(rt, rect, colour, Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); WidgetText(rt, w, widgetIndex); } @@ -506,24 +507,24 @@ namespace OpenRCT2::Ui uint8_t colour = w.colours[widget.colour].colour; // Border left of text - GfxFillRect(rt, { { l, t }, { l + 4, t } }, ColourMapA[colour].mid_dark); - GfxFillRect(rt, { { l + 1, t + 1 }, { l + 4, t + 1 } }, ColourMapA[colour].lighter); + Rect::fill(rt, { { l, t }, { l + 4, t } }, ColourMapA[colour].mid_dark); + Rect::fill(rt, { { l + 1, t + 1 }, { l + 4, t + 1 } }, ColourMapA[colour].lighter); // Border right of text - GfxFillRect(rt, { { textRight, t }, { r - 1, t } }, ColourMapA[colour].mid_dark); - GfxFillRect(rt, { { textRight, t + 1 }, { r - 2, t + 1 } }, ColourMapA[colour].lighter); + Rect::fill(rt, { { textRight, t }, { r - 1, t } }, ColourMapA[colour].mid_dark); + Rect::fill(rt, { { textRight, t + 1 }, { r - 2, t + 1 } }, ColourMapA[colour].lighter); // Border right - GfxFillRect(rt, { { r - 1, t + 1 }, { r - 1, b - 1 } }, ColourMapA[colour].mid_dark); - GfxFillRect(rt, { { r, t }, { r, b } }, ColourMapA[colour].lighter); + Rect::fill(rt, { { r - 1, t + 1 }, { r - 1, b - 1 } }, ColourMapA[colour].mid_dark); + Rect::fill(rt, { { r, t }, { r, b } }, ColourMapA[colour].lighter); // Border bottom - GfxFillRect(rt, { { l, b - 1 }, { r - 2, b - 1 } }, ColourMapA[colour].mid_dark); - GfxFillRect(rt, { { l, b }, { r - 1, b } }, ColourMapA[colour].lighter); + Rect::fill(rt, { { l, b - 1 }, { r - 2, b - 1 } }, ColourMapA[colour].mid_dark); + Rect::fill(rt, { { l, b }, { r - 1, b } }, ColourMapA[colour].lighter); // Border left - GfxFillRect(rt, { { l, t + 1 }, { l, b - 2 } }, ColourMapA[colour].mid_dark); - GfxFillRect(rt, { { l + 1, t + 2 }, { l + 1, b - 2 } }, ColourMapA[colour].lighter); + Rect::fill(rt, { { l, t + 1 }, { l, b - 2 } }, ColourMapA[colour].mid_dark); + Rect::fill(rt, { { l + 1, t + 2 }, { l + 1, b - 2 } }, ColourMapA[colour].lighter); } /** @@ -545,15 +546,15 @@ namespace OpenRCT2::Ui if (w.flags.has(WindowFlag::higherContrastOnPress)) press |= INSET_RECT_FLAG_FILL_MID_LIGHT; - GfxFillRectInset(rt, { topLeft, bottomRight }, colour, RectBorderStyle::inset, press); + Rect::fillInset(rt, { topLeft, bottomRight }, colour, Rect::BorderStyle::inset, press); // Black caption bars look slightly green, this fixes that if (colour.colour == COLOUR_BLACK) - GfxFillRect( + Rect::fill( rt, { { topLeft + ScreenCoordsXY{ 1, 1 } }, { bottomRight - ScreenCoordsXY{ 1, 1 } } }, ColourMapA[colour.colour].dark); else - GfxFilterRect( + Rect::filter( rt, { { topLeft + ScreenCoordsXY{ 1, 1 } }, { bottomRight - ScreenCoordsXY{ 1, 1 } } }, FilterPaletteID::paletteDarken3); @@ -598,16 +599,16 @@ namespace OpenRCT2::Ui // Check if the button is pressed down uint8_t press = 0; - auto borderStyle = RectBorderStyle::outset; + auto borderStyle = Rect::BorderStyle::outset; if (w.flags.has(WindowFlag::higherContrastOnPress)) press |= INSET_RECT_FLAG_FILL_MID_LIGHT; if (widgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex)) - borderStyle = RectBorderStyle::inset; + borderStyle = Rect::BorderStyle::inset; auto colour = w.colours[widget.colour]; // Draw the button - GfxFillRectInset(rt, { topLeft, bottomRight }, colour, borderStyle, press); + Rect::fillInset(rt, { topLeft, bottomRight }, colour, borderStyle, press); if (widget.string == nullptr) return; @@ -637,8 +638,8 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget.colour]; // checkbox - GfxFillRectInset( - rt, { midLeft - ScreenCoordsXY{ 0, 5 }, midLeft + ScreenCoordsXY{ 9, 4 } }, colour, RectBorderStyle::inset, + Rect::fillInset( + rt, { midLeft - ScreenCoordsXY{ 0, 5 }, midLeft + ScreenCoordsXY{ 9, 4 } }, colour, Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); if (widgetIsDisabled(w, widgetIndex)) @@ -688,7 +689,7 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget.colour]; // Draw the border - GfxFillRectInset(rt, { topLeft, bottomRight }, colour, RectBorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); + Rect::fillInset(rt, { topLeft, bottomRight }, colour, Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); // Inflate by -1 topLeft.x++; @@ -754,19 +755,19 @@ namespace OpenRCT2::Ui colour.setFlag(ColourFlag::translucent, false); // Trough - GfxFillRect(rt, { { l + kScrollBarWidth, t }, { r - kScrollBarWidth, b } }, ColourMapA[colour.colour].lighter); - GfxFillRect( + Rect::fill(rt, { { l + kScrollBarWidth, t }, { r - kScrollBarWidth, b } }, ColourMapA[colour.colour].lighter); + Rect::fill( rt, { { l + kScrollBarWidth, t }, { r - kScrollBarWidth, b } }, 0x1000000 | ColourMapA[colour.colour].mid_dark); - GfxFillRect(rt, { { l + kScrollBarWidth, t + 2 }, { r - kScrollBarWidth, t + 2 } }, ColourMapA[colour.colour].mid_dark); - GfxFillRect(rt, { { l + kScrollBarWidth, t + 3 }, { r - kScrollBarWidth, t + 3 } }, ColourMapA[colour.colour].lighter); - GfxFillRect(rt, { { l + kScrollBarWidth, t + 7 }, { r - kScrollBarWidth, t + 7 } }, ColourMapA[colour.colour].mid_dark); - GfxFillRect(rt, { { l + kScrollBarWidth, t + 8 }, { r - kScrollBarWidth, t + 8 } }, ColourMapA[colour.colour].lighter); + Rect::fill(rt, { { l + kScrollBarWidth, t + 2 }, { r - kScrollBarWidth, t + 2 } }, ColourMapA[colour.colour].mid_dark); + Rect::fill(rt, { { l + kScrollBarWidth, t + 3 }, { r - kScrollBarWidth, t + 3 } }, ColourMapA[colour.colour].lighter); + Rect::fill(rt, { { l + kScrollBarWidth, t + 7 }, { r - kScrollBarWidth, t + 7 } }, ColourMapA[colour.colour].mid_dark); + Rect::fill(rt, { { l + kScrollBarWidth, t + 8 }, { r - kScrollBarWidth, t + 8 } }, ColourMapA[colour.colour].lighter); // Left button { - auto borderStyle = (scroll.flags & HSCROLLBAR_LEFT_PRESSED) ? RectBorderStyle::inset : RectBorderStyle::outset; + auto borderStyle = (scroll.flags & HSCROLLBAR_LEFT_PRESSED) ? Rect::BorderStyle::inset : Rect::BorderStyle::outset; - GfxFillRectInset(rt, { { l, t }, { l + (kScrollBarWidth - 1), b } }, colour, borderStyle); + Rect::fillInset(rt, { { l, t }, { l + (kScrollBarWidth - 1), b } }, colour, borderStyle); DrawText(rt, { l + 1, t }, {}, kBlackLeftArrowString); } @@ -774,16 +775,16 @@ namespace OpenRCT2::Ui { int16_t left = std::max(l + kScrollBarWidth, l + scroll.hThumbLeft - 1); int16_t right = std::min(r - kScrollBarWidth, l + scroll.hThumbRight - 1); - auto borderStyle = (scroll.flags & HSCROLLBAR_THUMB_PRESSED) ? RectBorderStyle::inset : RectBorderStyle::outset; + auto borderStyle = (scroll.flags & HSCROLLBAR_THUMB_PRESSED) ? Rect::BorderStyle::inset : Rect::BorderStyle::outset; - GfxFillRectInset(rt, { { left, t }, { right, b } }, colour, borderStyle); + Rect::fillInset(rt, { { left, t }, { right, b } }, colour, borderStyle); } // Right button { - auto borderStyle = (scroll.flags & HSCROLLBAR_RIGHT_PRESSED) ? RectBorderStyle::inset : RectBorderStyle::outset; + auto borderStyle = (scroll.flags & HSCROLLBAR_RIGHT_PRESSED) ? Rect::BorderStyle::inset : Rect::BorderStyle::outset; - GfxFillRectInset(rt, { { r - (kScrollBarWidth - 1), t }, { r, b } }, colour, borderStyle); + Rect::fillInset(rt, { { r - (kScrollBarWidth - 1), t }, { r, b } }, colour, borderStyle); DrawText(rt, { r - 6, t }, {}, kBlackRightArrowString); } } @@ -794,31 +795,31 @@ namespace OpenRCT2::Ui colour.setFlag(ColourFlag::translucent, false); // Trough - GfxFillRect(rt, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, ColourMapA[colour.colour].lighter); - GfxFillRect( + Rect::fill(rt, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, ColourMapA[colour.colour].lighter); + Rect::fill( rt, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, 0x1000000 | ColourMapA[colour.colour].mid_dark); - GfxFillRect(rt, { { l + 2, t + kScrollBarWidth }, { l + 2, b - kScrollBarWidth } }, ColourMapA[colour.colour].mid_dark); - GfxFillRect(rt, { { l + 3, t + kScrollBarWidth }, { l + 3, b - kScrollBarWidth } }, ColourMapA[colour.colour].lighter); - GfxFillRect(rt, { { l + 7, t + kScrollBarWidth }, { l + 7, b - kScrollBarWidth } }, ColourMapA[colour.colour].mid_dark); - GfxFillRect(rt, { { l + 8, t + kScrollBarWidth }, { l + 8, b - kScrollBarWidth } }, ColourMapA[colour.colour].lighter); + Rect::fill(rt, { { l + 2, t + kScrollBarWidth }, { l + 2, b - kScrollBarWidth } }, ColourMapA[colour.colour].mid_dark); + Rect::fill(rt, { { l + 3, t + kScrollBarWidth }, { l + 3, b - kScrollBarWidth } }, ColourMapA[colour.colour].lighter); + Rect::fill(rt, { { l + 7, t + kScrollBarWidth }, { l + 7, b - kScrollBarWidth } }, ColourMapA[colour.colour].mid_dark); + Rect::fill(rt, { { l + 8, t + kScrollBarWidth }, { l + 8, b - kScrollBarWidth } }, ColourMapA[colour.colour].lighter); // Up button - GfxFillRectInset( + Rect::fillInset( rt, { { l, t }, { r, t + (kScrollBarWidth - 1) } }, colour, - ((scroll.flags & VSCROLLBAR_UP_PRESSED) ? RectBorderStyle::inset : RectBorderStyle::outset)); + ((scroll.flags & VSCROLLBAR_UP_PRESSED) ? Rect::BorderStyle::inset : Rect::BorderStyle::outset)); DrawText(rt, { l + 1, t - 1 }, {}, kBlackUpArrowString); // Thumb - GfxFillRectInset( + Rect::fillInset( rt, { { l, std::max(t + kScrollBarWidth, t + scroll.vThumbTop - 1) }, { r, std::min(b - kScrollBarWidth, t + scroll.vThumbBottom - 1) } }, - { colour }, ((scroll.flags & VSCROLLBAR_THUMB_PRESSED) ? RectBorderStyle::inset : RectBorderStyle::outset)); + { colour }, ((scroll.flags & VSCROLLBAR_THUMB_PRESSED) ? Rect::BorderStyle::inset : Rect::BorderStyle::outset)); // Down button - GfxFillRectInset( + Rect::fillInset( rt, { { l, b - (kScrollBarWidth - 1) }, { r, b } }, colour, - ((scroll.flags & VSCROLLBAR_DOWN_PRESSED) ? RectBorderStyle::inset : RectBorderStyle::outset)); + ((scroll.flags & VSCROLLBAR_DOWN_PRESSED) ? Rect::BorderStyle::inset : Rect::BorderStyle::outset)); DrawText(rt, { l + 1, b - (kScrollBarWidth - 1) }, {}, kBlackDownArrowString); } @@ -1136,9 +1137,10 @@ namespace OpenRCT2::Ui bool active = w.classification == tbIdent.window.classification && w.number == tbIdent.window.number && widgetIndex == tbIdent.widgetIndex; - // GfxFillRectInset(rt, l, t, r, b, colour, 0x20 | (!active ? 0x40 : 0x00)); - GfxFillRectInset( - rt, { topLeft, bottomRight }, w.colours[widget.colour], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); + // Rect::fillInset(rt, l, t, r, b, colour, 0x20 | (!active ? 0x40 : 0x00)); + Rect::fillInset( + rt, { topLeft, bottomRight }, w.colours[widget.colour], Rect::BorderStyle::inset, + INSET_RECT_FLAG_FILL_DONT_LIGHTEN); // Figure out where the text should be positioned vertically. topLeft.y = w.windowPos.y + widget.textTop(); @@ -1184,7 +1186,7 @@ namespace OpenRCT2::Ui { auto colour = ColourMapA[w.colours[1].colour].mid_light; auto y = topLeft.y + 1 + widget.height() - 4; - GfxFillRect(rt, { { curX, y }, { curX + width, y } }, colour + 5); + Rect::fill(rt, { { curX, y }, { curX + width, y } }, colour + 5); } } @@ -1202,7 +1204,7 @@ namespace OpenRCT2::Ui auto isBlinking = (lowerBlinkBounds != upperBlinkBounds) && (percentage >= lowerBlinkBounds) && (percentage <= upperBlinkBounds); - GfxFillRectInset(rt, { topLeft, bottomRight }, w.colours[1], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, { topLeft, bottomRight }, w.colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); if (isBlinking) { if (GameIsNotPaused() && (gCurrentRealTimeTicks & 8)) @@ -1213,7 +1215,7 @@ namespace OpenRCT2::Ui const int32_t fillSize = (barWidth * percentage) / 100; if (fillSize > 0) { - GfxFillRectInset( + Rect::fillInset( rt, { topLeft + ScreenCoordsXY{ 1, 1 }, topLeft + ScreenCoordsXY{ fillSize + 1, widget.height() - 1 } }, { widget.colour }); } @@ -1224,7 +1226,7 @@ namespace OpenRCT2::Ui ScreenCoordsXY topLeft{ w.windowPos + ScreenCoordsXY{ widget.left, widget.top } }; ScreenCoordsXY bottomRight{ w.windowPos + ScreenCoordsXY{ widget.right, widget.bottom } }; - GfxFillRectInset(rt, { topLeft, bottomRight }, w.colours[1], RectBorderStyle::inset); + Rect::fillInset(rt, { topLeft, bottomRight }, w.colours[1], Rect::BorderStyle::inset); } ImageId getColourButtonImage(colour_t colour) diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 326d8fa9d0..8aa7189860 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -31,6 +31,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui { // The amount of pixels to scroll per wheel click @@ -1023,7 +1025,7 @@ namespace OpenRCT2::Ui::Windows void WindowDrawWidgets(WindowBase& w, RenderTarget& rt) { if ((w.flags.has(WindowFlag::transparent)) && !(w.flags.has(WindowFlag::noBackground))) - GfxFilterRect( + Rect::filter( rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, FilterPaletteID::palette51); // todo: some code missing here? Between 006EB18C and 006EB260 @@ -1049,9 +1051,9 @@ namespace OpenRCT2::Ui::Windows if (w.flashTimer > 0) { - GfxFillRectInset( + Rect::fillInset( rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, { COLOUR_WHITE }, - RectBorderStyle::outset, INSET_RECT_FLAG_FILL_NONE); + Rect::BorderStyle::outset, INSET_RECT_FLAG_FILL_NONE); } } diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 1ecdc3f6ec..3c2417ea0a 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -22,6 +22,7 @@ #include #include +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Scripting; using namespace OpenRCT2::Ui::Windows; @@ -566,7 +567,7 @@ void CustomListView::MouseUp(const ScreenCoordsXY& pos) void CustomListView::Paint(WindowBase* w, RenderTarget& rt, const ScrollArea* scroll) const { auto paletteIndex = ColourMapA[w->colours[1].colour].mid_light; - GfxFillRect(rt, { { rt.x, rt.y }, { rt.x + rt.width, rt.y + rt.height } }, paletteIndex); + Rect::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width, rt.y + rt.height } }, paletteIndex); int32_t y = ShowColumnHeaders ? kColumnHeaderHeight : 0; for (size_t i = 0; i < Items.size(); i++) @@ -596,17 +597,17 @@ void CustomListView::Paint(WindowBase* w, RenderTarget& rt, const ScrollArea* sc auto isSelected = (SelectedCell && itemIndex == SelectedCell->Row); if (isSelected) { - GfxFilterRect( + Rect::filter( rt, { { rt.x, y }, { rt.x + rt.width, y + (kListRowHeight - 1) } }, FilterPaletteID::paletteDarken2); } else if (isHighlighted) { - GfxFilterRect( + Rect::filter( rt, { { rt.x, y }, { rt.x + rt.width, y + (kListRowHeight - 1) } }, FilterPaletteID::paletteDarken2); } else if (isStriped) { - GfxFillRect( + Rect::fill( rt, { { rt.x, y }, { rt.x + rt.width, y + (kListRowHeight - 1) } }, ColourMapA[w->colours[1].colour].lighter | 0x1000000); } @@ -653,7 +654,7 @@ void CustomListView::Paint(WindowBase* w, RenderTarget& rt, const ScrollArea* sc y = scroll->contentOffsetY; auto bgColour = ColourMapA[w->colours[1].colour].mid_light; - GfxFillRect(rt, { { rt.x, y }, { rt.x + rt.width, y + 12 } }, bgColour); + Rect::fill(rt, { { rt.x, y }, { rt.x + rt.width, y + 12 } }, bgColour); int32_t x = 0; for (int32_t j = 0; j < static_cast(Columns.size()); j++) @@ -680,12 +681,12 @@ void CustomListView::PaintHeading( WindowBase* w, RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const std::string& text, ColumnSortOrder sortOrder, bool isPressed) const { - auto borderStyle = RectBorderStyle::outset; + auto borderStyle = Rect::BorderStyle::outset; if (isPressed) { - borderStyle = RectBorderStyle::inset; + borderStyle = Rect::BorderStyle::inset; } - GfxFillRectInset(rt, { pos, pos + ScreenCoordsXY{ size.width - 1, size.height - 1 } }, w->colours[1], borderStyle); + Rect::fillInset(rt, { pos, pos + ScreenCoordsXY{ size.width - 1, size.height - 1 } }, w->colours[1], borderStyle); if (!text.empty()) { PaintCell(rt, pos, size, text.c_str(), false); diff --git a/src/openrct2-ui/scripting/ScGraphicsContext.hpp b/src/openrct2-ui/scripting/ScGraphicsContext.hpp index 6b6f1bb437..c69c36aa8b 100644 --- a/src/openrct2-ui/scripting/ScGraphicsContext.hpp +++ b/src/openrct2-ui/scripting/ScGraphicsContext.hpp @@ -17,6 +17,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Scripting { class ScGraphicsContext @@ -164,13 +166,13 @@ namespace OpenRCT2::Scripting void box(int32_t x, int32_t y, int32_t width, int32_t height) { - GfxFillRectInset(_rt, { x, y, x + width - 1, y + height - 1 }, { _colour.value_or(0) }); + Rect::fillInset(_rt, { x, y, x + width - 1, y + height - 1 }, { _colour.value_or(0) }); } void well(int32_t x, int32_t y, int32_t width, int32_t height) { - GfxFillRectInset( - _rt, { x, y, x + width - 1, y + height - 1 }, { _colour.value_or(0) }, RectBorderStyle::inset, + Rect::fillInset( + _rt, { x, y, x + width - 1, y + height - 1 }, { _colour.value_or(0) }, Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); } @@ -230,7 +232,7 @@ namespace OpenRCT2::Scripting } if (_fill != 0) { - GfxFillRect(_rt, { x, y, x + width - 1, y + height - 1 }, _fill); + Rect::fill(_rt, { x, y, x + width - 1, y + height - 1 }, _fill); } } diff --git a/src/openrct2-ui/windows/AssetPacks.cpp b/src/openrct2-ui/windows/AssetPacks.cpp index 3806998773..3e0395eb55 100644 --- a/src/openrct2-ui/windows/AssetPacks.cpp +++ b/src/openrct2-ui/windows/AssetPacks.cpp @@ -22,6 +22,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr StringId kWindowTitle = STR_ASSET_PACKS; @@ -193,7 +195,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; - GfxFillRect( + Rect::fill( rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width - 1, rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); @@ -242,12 +244,12 @@ namespace OpenRCT2::Ui::Windows auto fillRectangle = ScreenRect{ { 0, y }, { listWidth, y + ItemHeight - 1 } }; if (isSelected) { - GfxFillRect(rt, fillRectangle, ColourMapA[colours[1].colour].mid_dark); + Rect::fill(rt, fillRectangle, ColourMapA[colours[1].colour].mid_dark); stringId = STR_WINDOW_COLOUR_2_STRINGID; } else if (isHighlighted) { - GfxFillRect(rt, fillRectangle, ColourMapA[colours[1].colour].mid_dark); + Rect::fill(rt, fillRectangle, ColourMapA[colours[1].colour].mid_dark); } DrawTextEllipsised(rt, { 16, y + 1 }, listWidth, stringId, ft); @@ -258,8 +260,8 @@ namespace OpenRCT2::Ui::Windows void PaintCheckbox(RenderTarget& rt, const ScreenRect& rect, bool checked) { - GfxFillRectInset( - rt, rect, colours[1], RectBorderStyle::inset, + Rect::fillInset( + rt, rect, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN | INSET_RECT_FLAG_FILL_MID_LIGHT); if (checked) { diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 603b5d078f..b72bf5b098 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -27,6 +27,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { constexpr int32_t kDropdownItemHeight = 12; @@ -126,13 +128,13 @@ namespace OpenRCT2::Ui::Windows if (colours[0].hasFlag(ColourFlag::translucent)) { TranslucentWindowPalette palette = kTranslucentWindowPalettes[colours[0].colour]; - GfxFilterRect(rt, { leftTop, rightBottom }, palette.highlight); - GfxFilterRect(rt, { leftTop + shadowOffset, rightBottom + shadowOffset }, palette.shadow); + Rect::filter(rt, { leftTop, rightBottom }, palette.highlight); + Rect::filter(rt, { leftTop + shadowOffset, rightBottom + shadowOffset }, palette.shadow); } else { - GfxFillRect(rt, { leftTop, rightBottom }, ColourMapA[colours[0].colour].mid_dark); - GfxFillRect( + Rect::fill(rt, { leftTop, rightBottom }, ColourMapA[colours[0].colour].mid_dark); + Rect::fill( rt, { leftTop + shadowOffset, rightBottom + shadowOffset }, ColourMapA[colours[0].colour].lightest); } } @@ -143,7 +145,7 @@ namespace OpenRCT2::Ui::Windows { // Darken the cell's background slightly when highlighted const ScreenCoordsXY rightBottom = screenCoords + ScreenCoordsXY{ ItemWidth - 1, ItemHeight - 1 }; - GfxFilterRect(rt, { screenCoords, rightBottom }, FilterPaletteID::paletteDarken3); + Rect::filter(rt, { screenCoords, rightBottom }, FilterPaletteID::paletteDarken3); } const auto& item = gDropdown.items[i]; diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index d145da37fe..adb2277132 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -31,6 +31,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr int32_t kToolbarHeight = 32; @@ -337,7 +339,7 @@ namespace OpenRCT2::Ui::Windows const auto& previousWidget = widgets[WIDX_PREVIOUS_IMAGE]; auto leftTop = windowPos + ScreenCoordsXY{ previousWidget.left, previousWidget.top }; auto rightBottom = windowPos + ScreenCoordsXY{ previousWidget.right, previousWidget.bottom }; - GfxFilterRect(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); + Rect::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); } void DrawLeftButton(RenderTarget& rt) @@ -346,7 +348,7 @@ namespace OpenRCT2::Ui::Windows + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 1, widgets[WIDX_PREVIOUS_IMAGE].top + 1 }; const auto bottomRight = windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].right - 1, widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 }; - GfxFillRectInset(rt, { topLeft, bottomRight }, colours[1], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, { topLeft, bottomRight }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); GfxDrawSprite( rt, ImageId(SPR_PREVIOUS), @@ -375,7 +377,7 @@ namespace OpenRCT2::Ui::Windows auto nextWidget = widgets[WIDX_NEXT_IMAGE]; auto leftTop = windowPos + ScreenCoordsXY{ nextWidget.left, nextWidget.top }; auto rightBottom = windowPos + ScreenCoordsXY{ nextWidget.right, nextWidget.bottom }; - GfxFilterRect(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); + Rect::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); } void DrawRightButton(RenderTarget& rt) @@ -384,7 +386,7 @@ namespace OpenRCT2::Ui::Windows + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].left + 1, widgets[WIDX_NEXT_IMAGE].top + 1 }; const auto bottomRight = windowPos + ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].right - 1, widgets[WIDX_NEXT_IMAGE].bottom - 1 }; - GfxFillRectInset(rt, { topLeft, bottomRight }, colours[1], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, { topLeft, bottomRight }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); GfxDrawSprite( rt, ImageId(SPR_NEXT), diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 3eac79a9c1..3876cf1b43 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -29,6 +29,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { #pragma region Widgets @@ -302,7 +304,7 @@ namespace OpenRCT2::Ui::Windows bottom = itemY; } - GfxFilterRect(rt, { 0, top, boxWidth, bottom }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, top, boxWidth, bottom }, FilterPaletteID::paletteDarken1); } if (dragItem != nullptr && researchItem == *dragItem) @@ -372,7 +374,7 @@ namespace OpenRCT2::Ui::Windows // Preview background auto& bkWidget = widgets[WIDX_PREVIEW]; - GfxFillRect( + Rect::fill( rt, { windowPos + ScreenCoordsXY{ bkWidget.left + 1, bkWidget.top + 1 }, windowPos + ScreenCoordsXY{ bkWidget.right - 1, bkWidget.bottom - 1 } }, diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 106109794a..79d574dc83 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -47,6 +47,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { enum : uint16_t @@ -740,8 +742,8 @@ namespace OpenRCT2::Ui::Windows { // Draw checkbox if (!(gLegacyScene == LegacyScene::trackDesignsManager) && !(*listItem.flags & 0x20)) - GfxFillRectInset( - rt, { { 2, screenCoords.y }, { 11, screenCoords.y + 10 } }, colours[1], RectBorderStyle::inset, + Rect::fillInset( + rt, { { 2, screenCoords.y }, { 11, screenCoords.y + 10 } }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN | INSET_RECT_FLAG_FILL_MID_LIGHT); // Highlight background @@ -750,7 +752,7 @@ namespace OpenRCT2::Ui::Windows if (highlighted) { auto bottom = screenCoords.y + (kScrollableRowHeight - 1); - GfxFilterRect(rt, { 0, screenCoords.y, width, bottom }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, screenCoords.y, width, bottom }, FilterPaletteID::paletteDarken1); } // Draw checkmark @@ -1059,7 +1061,7 @@ namespace OpenRCT2::Ui::Windows // Preview background const auto& previewWidget = widgets[WIDX_PREVIEW]; - GfxFillRect( + Rect::fill( rt, { windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 }, windowPos + ScreenCoordsXY{ previewWidget.right - 1, previewWidget.bottom - 1 } }, diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index 39411dc2db..2ddb49685c 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -29,6 +29,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr StringId kWindowTitle = STR_OBJECT_SELECTION_PARK_ENTRANCE; @@ -314,11 +316,11 @@ namespace OpenRCT2::Ui::Windows for (auto& entranceType : _entranceTypes) { // Draw flat button rectangle - auto borderStyle = RectBorderStyle::outset; + auto borderStyle = Rect::BorderStyle::outset; int32_t buttonFlags = 0; if (_selectedEntranceType == entranceType.entryIndex) { - borderStyle = RectBorderStyle::inset; + borderStyle = Rect::BorderStyle::inset; buttonFlags |= INSET_RECT_FLAG_FILL_MID_LIGHT; } else if (_highlightedEntranceType == entranceType.entryIndex) @@ -327,7 +329,7 @@ namespace OpenRCT2::Ui::Windows } if (buttonFlags != 0) - GfxFillRectInset( + Rect::fillInset( rt, { coords, coords + ScreenCoordsXY{ kImageSize - 1, kImageSize - 1 } }, colours[1], borderStyle, buttonFlags); diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 392abf7d25..b4b74e244d 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -37,6 +37,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr ScreenSize kSizeObjective = { 450, 122 }; @@ -2338,7 +2340,7 @@ namespace OpenRCT2::Ui::Windows void RidesOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) { int32_t colour = ColourMapA[colours[1].colour].mid_light; - GfxFillRect(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour); + Rect::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour); for (int32_t i = 0; i < static_cast(_rideableRides.size()); i++) { @@ -2348,8 +2350,8 @@ namespace OpenRCT2::Ui::Windows continue; // Checkbox - GfxFillRectInset( - rt, { { 2, y }, { 11, y + 10 } }, colours[1], RectBorderStyle::inset, + Rect::fillInset( + rt, { { 2, y }, { 11, y + 10 } }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN | INSET_RECT_FLAG_FILL_MID_LIGHT); // Highlighted @@ -2357,7 +2359,7 @@ namespace OpenRCT2::Ui::Windows if (i == selectedListItem) { stringId = STR_WINDOW_COLOUR_2_STRINGID; - GfxFilterRect(rt, { 0, y, width, y + 11 }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y, width, y + 11 }, FilterPaletteID::paletteDarken1); } // Checkbox mark diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 0ccae1d5d6..6a2ad586fe 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -24,6 +24,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { enum @@ -408,7 +410,7 @@ namespace OpenRCT2::Ui::Windows { // Darken every even row if (i % 2 == 0) - GfxFillRect( + Rect::fill( rt, { screenCoords - ScreenCoordsXY{ 0, 1 }, screenCoords + ScreenCoordsXY{ row_width, (kTableCellHeight - 2) } }, @@ -463,7 +465,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic( rt, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, 0 }, format, ft, { TextAlignment::RIGHT }); - GfxFillRect( + Rect::fill( rt, { screenCoords + ScreenCoordsXY{ 10, -2 }, screenCoords + ScreenCoordsXY{ kExpenditureColumnWidth, -2 } }, PaletteIndex::pi10); @@ -603,7 +605,7 @@ namespace OpenRCT2::Ui::Windows { // Darken every even row if (i % 2 == 0) - GfxFillRect( + Rect::fill( rt, { screenCoords - ScreenCoordsXY{ 0, 1 }, screenCoords + ScreenCoordsXY{ 121, (kTableCellHeight - 2) } }, ColourMapA[colours[1].colour].lighter | 0x1000000); @@ -613,11 +615,11 @@ namespace OpenRCT2::Ui::Windows } // Horizontal rule below expenditure / income table - GfxFillRectInset( + Rect::fillInset( rt, { windowPos + ScreenCoordsXY{ 8, titleBarBottom + 258 }, windowPos + ScreenCoordsXY{ 8 + 513, titleBarBottom + 258 + 1 } }, - colours[1], RectBorderStyle::inset); + colours[1], Rect::BorderStyle::inset); // Loan and interest rate DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 8, titleBarBottom + 265 }, STR_FINANCES_SUMMARY_LOAN); @@ -790,12 +792,12 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, _graphBounds.Point1 - ScreenCoordsXY{ 0, 11 }, fmt, ft); // Graph - GfxFillRectInset(rt, _graphBounds, colours[1], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, _graphBounds, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); // hide resize widget on graph area constexpr ScreenCoordsXY offset{ 1, 1 }; constexpr ScreenCoordsXY bigOffset{ 5, 5 }; - GfxFillRectInset( - rt, { _graphBounds.Point2 - bigOffset, _graphBounds.Point2 - offset }, colours[1], RectBorderStyle::none, + Rect::fillInset( + rt, { _graphBounds.Point2 - bigOffset, _graphBounds.Point2 - offset }, colours[1], Rect::BorderStyle::none, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); Graph::DrawFinanceGraph(rt, _graphProps); diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index 9ad9f10634..9beb284588 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -33,6 +33,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { enum WindowGameBottomToolbarWidgetIdx @@ -93,7 +95,7 @@ namespace OpenRCT2::Ui::Windows const auto topLeft = windowPos + ScreenCoordsXY{ leftPanelWidget.left + 1, leftPanelWidget.top + 1 }; const auto bottomRight = windowPos + ScreenCoordsXY{ leftPanelWidget.right - 1, leftPanelWidget.bottom - 1 }; // Draw green inset rectangle on panel - GfxFillRectInset(rt, { topLeft, bottomRight }, colours[0], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, { topLeft, bottomRight }, colours[0], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); // Figure out how much line height we have to work with. uint32_t line_height = FontGetLineHeight(FontStyle::Medium); @@ -152,14 +154,14 @@ namespace OpenRCT2::Ui::Windows void DrawParkRating(RenderTarget& rt, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor) { int16_t bar_width = (factor * 114) / 255; - GfxFillRectInset( - rt, { coords + ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 114, 9 } }, colours[0], RectBorderStyle::inset, - INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset( + rt, { coords + ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 114, 9 } }, colours[0], + Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); if (!(colour & kBarBlink) || GameIsPaused() || (gCurrentRealTimeTicks & 8)) { if (bar_width > 2) { - GfxFillRectInset( + Rect::fillInset( rt, { coords + ScreenCoordsXY{ 2, 2 }, coords + ScreenCoordsXY{ bar_width - 1, 8 } }, ColourWithFlags{ static_cast(colour) }); } @@ -177,7 +179,7 @@ namespace OpenRCT2::Ui::Windows const auto topLeft = windowPos + ScreenCoordsXY{ rightPanelWidget.left + 1, rightPanelWidget.top + 1 }; const auto bottomRight = windowPos + ScreenCoordsXY{ rightPanelWidget.right - 1, rightPanelWidget.bottom - 1 }; // Draw green inset rectangle on panel - GfxFillRectInset(rt, { topLeft, bottomRight }, colours[0], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, { topLeft, bottomRight }, colours[0], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); auto screenCoords = ScreenCoordsXY{ (rightPanelWidget.left + rightPanelWidget.right) / 2 + windowPos.x, rightPanelWidget.top + windowPos.y + 2 }; @@ -236,12 +238,12 @@ namespace OpenRCT2::Ui::Windows auto* newsItem = News::GetItem(0); // Current news item - GfxFillRectInset( + Rect::fillInset( rt, { windowPos + ScreenCoordsXY{ middleOutsetWidget.left + 1, middleOutsetWidget.top + 1 }, windowPos + ScreenCoordsXY{ middleOutsetWidget.right - 1, middleOutsetWidget.bottom - 1 } }, - colours[2], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + colours[2], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); // Text auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget.midX(), middleOutsetWidget.top + 11 }; @@ -350,11 +352,11 @@ namespace OpenRCT2::Ui::Windows { Widget* middleOutsetWidget = &widgets[WIDX_MIDDLE_OUTSET]; - GfxFillRectInset( + Rect::fillInset( rt, { windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 }, windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } }, - colours[0], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + colours[0], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); // Figure out how much line height we have to work with. uint32_t line_height = FontGetLineHeight(FontStyle::Medium); @@ -622,18 +624,18 @@ namespace OpenRCT2::Ui::Windows // Draw panel grey backgrounds auto leftTop = windowPos + ScreenCoordsXY{ leftWidget.left, leftWidget.top }; auto rightBottom = windowPos + ScreenCoordsXY{ leftWidget.right, leftWidget.bottom }; - GfxFilterRect(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); + Rect::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); leftTop = windowPos + ScreenCoordsXY{ rightWidget.left, rightWidget.top }; rightBottom = windowPos + ScreenCoordsXY{ rightWidget.right, rightWidget.bottom }; - GfxFilterRect(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); + Rect::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) { // Draw grey background leftTop = windowPos + ScreenCoordsXY{ middleWidget.left, middleWidget.top }; rightBottom = windowPos + ScreenCoordsXY{ middleWidget.right, middleWidget.bottom }; - GfxFilterRect(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); + Rect::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51); } drawWidgets(rt); diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 5460de6d9f..cc84f80ad9 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -45,6 +45,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr StringId kWindowTitle = STR_STRINGID; @@ -1356,7 +1358,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDrawRides(int32_t scrollIndex, RenderTarget& rt) { auto colour = ColourMapA[colours[1].colour].mid_light; - GfxFillRect(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour); + Rect::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour); for (int32_t listIndex = 0; listIndex < static_cast(_riddenRides.size()); listIndex++) { @@ -1364,7 +1366,7 @@ namespace OpenRCT2::Ui::Windows StringId stringId = STR_BLACK_STRING; if (listIndex == selectedListItem) { - GfxFilterRect(rt, { 0, y, 800, y + 9 }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y, 800, y + 9 }, FilterPaletteID::paletteDarken1); stringId = STR_WINDOW_COLOUR_2_STRINGID; } @@ -1443,9 +1445,9 @@ namespace OpenRCT2::Ui::Windows screenCoords.y += kListRowHeight * 2; } - GfxFillRectInset( + Rect::fillInset( rt, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 179, -5 } }, colours[1], - RectBorderStyle::inset); + Rect::BorderStyle::inset); // Paid to enter { diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index feb53958bf..14a0347de2 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -31,6 +31,7 @@ #include #include +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Numerics; namespace OpenRCT2::Ui::Windows @@ -574,7 +575,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { - GfxFillRect( + Rect::fill( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); switch (_selectedTab) { @@ -656,7 +657,7 @@ namespace OpenRCT2::Ui::Windows StringId format = STR_BLACK_STRING; if (index == _highlightedIndex) { - GfxFilterRect(rt, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::paletteDarken1); format = STR_WINDOW_COLOUR_2_STRINGID; } @@ -726,7 +727,7 @@ namespace OpenRCT2::Ui::Windows StringId format = STR_BLACK_STRING; if (index == _highlightedIndex) { - GfxFilterRect(rt, { 0, y, 800, y + kSummarisedGuestsRowHeight }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y, 800, y + kSummarisedGuestsRowHeight }, FilterPaletteID::paletteDarken1); format = STR_WINDOW_COLOUR_2_STRINGID; } diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 0d345dddf1..d8fa9387f7 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -31,6 +31,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { enum @@ -155,7 +157,7 @@ namespace OpenRCT2::Ui::Windows Widget* widget = &widgets[WIDX_TRACK_PREVIEW]; auto screenPos = windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 }; int32_t colour = ColourMapA[colours[0].colour].darkest; - GfxFillRect(rt, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour); + Rect::fill(rt, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour); G1Element g1temp = {}; g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * kTrackPreviewImageSize); diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 51223a59d4..5b1e48248b 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -52,6 +52,7 @@ namespace OpenRCT2::Ui::Windows { + using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Ui::FileBrowser; #pragma region Widgets @@ -443,8 +444,8 @@ namespace OpenRCT2::Ui::Windows if (drawFrame) { - GfxFillRectInset( - rt, { frameStartPos, frameEndPos }, colours[1], RectBorderStyle::inset, + Rect::fillInset( + rt, { frameStartPos, frameEndPos }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN | INSET_RECT_FLAG_FILL_MID_LIGHT); } @@ -1077,7 +1078,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { - GfxFillRect( + Rect::fill( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); const int32_t listWidth = widgets[WIDX_SCROLL].width(); @@ -1102,7 +1103,7 @@ namespace OpenRCT2::Ui::Windows if (i == selectedListItem) { stringId = STR_WINDOW_COLOUR_2_STRINGID; - GfxFilterRect(rt, { 0, y, listWidth, y + kScrollableRowHeight }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y, listWidth, y + kScrollableRowHeight }, FilterPaletteID::paletteDarken1); } // display a marker next to the currently loaded game file if (_listItems[i].loaded) diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 5ca4f6b262..b4e082670b 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -43,6 +43,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr uint16_t MapColour2(uint8_t colourA, uint8_t colourB) @@ -677,7 +679,7 @@ namespace OpenRCT2::Ui::Windows for (uint32_t i = 0; i < std::size(RideKeyColours); i++) { - GfxFillRect( + Rect::fill( rt, { screenCoords + ScreenCoordsXY{ 0, 2 }, screenCoords + ScreenCoordsXY{ 6, 8 } }, RideKeyColours[i]); DrawTextBasic(rt, screenCoords + ScreenCoordsXY{ kListRowHeight, 0 }, MapLabels[i], {}); @@ -980,7 +982,7 @@ namespace OpenRCT2::Ui::Windows } } - GfxFillRect(rt, { leftTop, rightBottom }, colour); + Rect::fill(rt, { leftTop, rightBottom }, colour); } uint8_t GetGuestFlashColour() const @@ -1020,13 +1022,13 @@ namespace OpenRCT2::Ui::Windows auto mapCoord = TransformToMapCoords({ vehicle->x, vehicle->y }); auto pixelCoord = ScreenCoordsXY{ mapCoord.x, mapCoord.y } + offset; - GfxFillRect(rt, { pixelCoord, pixelCoord }, PaletteIndex::pi171); + Rect::fill(rt, { pixelCoord, pixelCoord }, PaletteIndex::pi171); } } } /** - * The call to GfxFillRect was originally wrapped in Sub68DABD which made sure that arguments were ordered correctly, + * The call to Rect::fill was originally wrapped in Sub68DABD which made sure that arguments were ordered correctly, * but it doesn't look like it's ever necessary here so the call was removed. */ void PaintHudRectangle(RenderTarget& rt, const ScreenCoordsXY& widgetOffset) @@ -1051,20 +1053,20 @@ namespace OpenRCT2::Ui::Windows auto leftBottom = ScreenCoordsXY{ leftTop.x, rightBottom.y }; // top horizontal lines - GfxFillRect(rt, { leftTop, leftTop + ScreenCoordsXY{ 3, 0 } }, PaletteIndex::pi56); - GfxFillRect(rt, { rightTop - ScreenCoordsXY{ 3, 0 }, rightTop }, PaletteIndex::pi56); + Rect::fill(rt, { leftTop, leftTop + ScreenCoordsXY{ 3, 0 } }, PaletteIndex::pi56); + Rect::fill(rt, { rightTop - ScreenCoordsXY{ 3, 0 }, rightTop }, PaletteIndex::pi56); // left vertical lines - GfxFillRect(rt, { leftTop, leftTop + ScreenCoordsXY{ 0, 3 } }, PaletteIndex::pi56); - GfxFillRect(rt, { leftBottom - ScreenCoordsXY{ 0, 3 }, leftBottom }, PaletteIndex::pi56); + Rect::fill(rt, { leftTop, leftTop + ScreenCoordsXY{ 0, 3 } }, PaletteIndex::pi56); + Rect::fill(rt, { leftBottom - ScreenCoordsXY{ 0, 3 }, leftBottom }, PaletteIndex::pi56); // bottom horizontal lines - GfxFillRect(rt, { leftBottom, leftBottom + ScreenCoordsXY{ 3, 0 } }, PaletteIndex::pi56); - GfxFillRect(rt, { rightBottom - ScreenCoordsXY{ 3, 0 }, rightBottom }, PaletteIndex::pi56); + Rect::fill(rt, { leftBottom, leftBottom + ScreenCoordsXY{ 3, 0 } }, PaletteIndex::pi56); + Rect::fill(rt, { rightBottom - ScreenCoordsXY{ 3, 0 }, rightBottom }, PaletteIndex::pi56); // right vertical lines - GfxFillRect(rt, { rightTop, rightTop + ScreenCoordsXY{ 0, 3 } }, PaletteIndex::pi56); - GfxFillRect(rt, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PaletteIndex::pi56); + Rect::fill(rt, { rightTop, rightTop + ScreenCoordsXY{ 0, 3 } }, PaletteIndex::pi56); + Rect::fill(rt, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PaletteIndex::pi56); } void DrawTabImages(RenderTarget& rt) diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 842eefc993..ed4e3dd3c4 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -22,6 +22,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { enum @@ -268,7 +270,7 @@ namespace OpenRCT2::Ui::Windows auto colour = ColourWithFlags{ COLOUR_BLACK }; if (listPosition == selectedListItem) { - GfxFilterRect( + Rect::filter( rt, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 }, FilterPaletteID::paletteDarken1); _buffer += Network::GetPlayerName(player); @@ -368,9 +370,9 @@ namespace OpenRCT2::Ui::Windows screenPos.y += 20; - GfxFillRectInset( + Rect::fillInset( rt, { screenPos - ScreenCoordsXY{ 0, 6 }, screenPos + ScreenCoordsXY{ 310, -5 } }, colours[1], - RectBorderStyle::inset); + Rect::BorderStyle::inset); widget = &widgets[WIDX_SELECTED_GROUP]; group = Network::GetGroupIndex(_selectedGroup); @@ -391,7 +393,7 @@ namespace OpenRCT2::Ui::Windows auto screenCoords = ScreenCoordsXY{ 0, 0 }; auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; - GfxFillRect( + Rect::fill( rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width - 1, rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); @@ -399,7 +401,7 @@ namespace OpenRCT2::Ui::Windows { if (i == selectedListItem) { - GfxFilterRect( + Rect::filter( rt, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 }, FilterPaletteID::paletteDarken1); } diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 9dab97945c..dfa543cbee 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -39,6 +39,7 @@ #include #include +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::TrackMetaData; namespace OpenRCT2::Ui::Windows @@ -490,12 +491,12 @@ namespace OpenRCT2::Ui::Windows while (listItem->Type != kRideTypeNull || listItem->EntryIndex != kObjectEntryIndexNull) { // Draw flat button rectangle - auto borderStyle = RectBorderStyle::none; + auto borderStyle = Rect::BorderStyle::none; if (_newRideVars.SelectedRide == *listItem) - borderStyle = RectBorderStyle::inset; + borderStyle = Rect::BorderStyle::inset; - if (_newRideVars.HighlightedRide == *listItem || borderStyle != RectBorderStyle::none) - GfxFillRectInset( + if (_newRideVars.HighlightedRide == *listItem || borderStyle != Rect::BorderStyle::none) + Rect::fillInset( rt, { coords, coords + ScreenCoordsXY{ 115, 115 } }, colours[1], borderStyle, INSET_RECT_FLAG_FILL_MID_LIGHT); diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index a621d3a9bd..a9a310ed6d 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -26,6 +26,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr ScreenSize kWindowSize = { 400, 300 }; @@ -463,11 +465,11 @@ namespace OpenRCT2::Ui::Windows } // Outer frame - GfxFillRectInset( - rt, { -1, y, 383 + scrollbarFill, y + itemHeight - 1 }, colours[1], RectBorderStyle::inset, + Rect::fillInset( + rt, { -1, y, 383 + scrollbarFill, y + itemHeight - 1 }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); // Background - GfxFillRect(rt, { 0, y + 1, 381 + scrollbarFill, y + itemHeight - 2 }, backgroundPaletteIndex); + Rect::fill(rt, { 0, y + 1, 381 + scrollbarFill, y + itemHeight - 2 }, backgroundPaletteIndex); // Date text { @@ -489,16 +491,16 @@ namespace OpenRCT2::Ui::Windows { auto screenCoords = ScreenCoordsXY{ 328 + scrollbarFill, y + lineHeight + 4 }; - auto borderStyle = RectBorderStyle::outset; + auto borderStyle = Rect::BorderStyle::outset; if (_pressedNewsItemIndex != -1) { News::IsValidIndex(_pressedNewsItemIndex + News::ItemHistoryStart); if (i == _pressedNewsItemIndex && _pressedButtonIndex == 1) { - borderStyle = RectBorderStyle::inset; + borderStyle = Rect::BorderStyle::inset; } } - GfxFillRectInset(rt, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], borderStyle); + Rect::fillInset(rt, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], borderStyle); switch (newsItem.type) { @@ -570,14 +572,14 @@ namespace OpenRCT2::Ui::Windows { auto screenCoords = ScreenCoordsXY{ 352 + scrollbarFill, y + lineHeight + 4 }; - auto borderStyle = RectBorderStyle::outset; + auto borderStyle = Rect::BorderStyle::outset; if (_pressedNewsItemIndex != -1) { News::IsValidIndex(_pressedNewsItemIndex + News::ItemHistoryStart); if (i == _pressedNewsItemIndex && _pressedButtonIndex == 2) - borderStyle = RectBorderStyle::inset; + borderStyle = Rect::BorderStyle::inset; } - GfxFillRectInset(rt, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], borderStyle); + Rect::fillInset(rt, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], borderStyle); GfxDrawSprite(rt, ImageId(SPR_LOCATE), screenCoords); } diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index d04d30ef7a..e85e838336 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -31,6 +31,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { #ifndef DISABLE_HTTP @@ -511,7 +513,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; - GfxFillRect( + Rect::fill( rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width - 1, rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); const int32_t listWidth = widgets[WIDX_SCROLL].width(); @@ -530,11 +532,11 @@ namespace OpenRCT2::Ui::Windows { listWidth, screenCoords.y + kScrollableRowHeight - 1 } }; // If hovering over item, change the color and fill the backdrop. if (i == selectedListItem) - GfxFillRect(rt, screenRect, ColourMapA[colours[1].colour].darker); + Rect::fill(rt, screenRect, ColourMapA[colours[1].colour].darker); else if (i == _highlightedIndex) - GfxFillRect(rt, screenRect, ColourMapA[colours[1].colour].mid_dark); + Rect::fill(rt, screenRect, ColourMapA[colours[1].colour].mid_dark); else if ((i & 1) != 0) // odd / even check - GfxFillRect(rt, screenRect, ColourMapA[colours[1].colour].light); + Rect::fill(rt, screenRect, ColourMapA[colours[1].colour].light); // Draw the actual object entry's name... screenCoords.x = kNameColLeft - 3; diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 5b68722b86..68cb12b1c6 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -34,6 +34,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr StringId kWindowTitle = STR_STRINGID; @@ -711,13 +713,13 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, windowPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_PARK_RATING_LABEL, ft); // Graph border - GfxFillRectInset(rt, _ratingGraphBounds, colours[1], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, _ratingGraphBounds, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); // hide resize widget on graph area constexpr ScreenCoordsXY offset{ 1, 1 }; constexpr ScreenCoordsXY bigOffset{ 5, 5 }; - GfxFillRectInset( + Rect::fillInset( rt, { _ratingGraphBounds.Point2 - bigOffset, _ratingGraphBounds.Point2 - offset }, colours[1], - RectBorderStyle::none, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); + Rect::BorderStyle::none, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); Graph::DrawRatingGraph(rt, _ratingProps); } @@ -790,13 +792,13 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, windowPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_GUESTS_IN_PARK_LABEL, ft); // Graph border - GfxFillRectInset(rt, _guestGraphBounds, colours[1], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset(rt, _guestGraphBounds, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_NONE); // hide resize widget on graph area constexpr ScreenCoordsXY offset{ 1, 1 }; constexpr ScreenCoordsXY bigOffset{ 5, 5 }; - GfxFillRectInset( + Rect::fillInset( rt, { _guestGraphBounds.Point2 - bigOffset, _guestGraphBounds.Point2 - offset }, colours[1], - RectBorderStyle::none, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); + Rect::BorderStyle::none, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); Graph::DrawGuestGraph(rt, _guestProps); } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 06c3a49e0a..de79d0448d 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -77,6 +77,7 @@ #include #include +using namespace OpenRCT2::Drawing; using namespace OpenRCT2::TrackMetaData; namespace OpenRCT2::Ui::Windows @@ -2953,7 +2954,7 @@ namespace OpenRCT2::Ui::Windows const auto* rideEntry = ride->getRideEntry(); // Background - GfxFillRect(rt, { { rt.x, rt.y }, { rt.x + rt.width, rt.y + rt.height } }, PaletteIndex::pi12); + Rect::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width, rt.y + rt.height } }, PaletteIndex::pi12); Widget* widget = &widgets[WIDX_VEHICLE_TRAINS_PREVIEW]; int32_t startX = std::max(2, (widget->width() - ((ride->numTrains - 1) * 36)) / 2 - 25); @@ -3691,11 +3692,11 @@ namespace OpenRCT2::Ui::Windows // Horizontal rule between mode settings and depart settings auto ruleStart = widgets[WIDX_LOAD_DROPDOWN].top - 8; - GfxFillRectInset( + Rect::fillInset( rt, { windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, ruleStart }, windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].right - 5, ruleStart + 1 } }, - colours[1], RectBorderStyle::inset); + colours[1], Rect::BorderStyle::inset); // Number of block sections if (ride->isBlockSectioned()) @@ -4824,7 +4825,7 @@ namespace OpenRCT2::Ui::Windows // Track / shop item preview const auto& trackPreviewWidget = widgets[WIDX_TRACK_PREVIEW]; if (trackPreviewWidget.type != WidgetType::empty) - GfxFillRect( + Rect::fill( rt, { { windowPos + ScreenCoordsXY{ trackPreviewWidget.left + 1, trackPreviewWidget.top + 1 } }, { windowPos + ScreenCoordsXY{ trackPreviewWidget.right - 1, trackPreviewWidget.bottom - 1 } } }, @@ -4932,7 +4933,7 @@ namespace OpenRCT2::Ui::Windows auto vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex); // Background colour - GfxFillRect(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, PaletteIndex::pi12); + Rect::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, PaletteIndex::pi12); // ? auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 }; @@ -5619,8 +5620,8 @@ namespace OpenRCT2::Ui::Windows widgetCoords.x = windowPos.x + 4; widgetCoords.y = windowPos.y + widgets[WIDX_SELECT_NEARBY_SCENERY].bottom + 17; - GfxFillRectInset( - rt, { widgetCoords, { windowPos.x + 312, widgetCoords.y + 1 } }, colours[1], RectBorderStyle::inset); + Rect::fillInset( + rt, { widgetCoords, { windowPos.x + 312, widgetCoords.y + 1 } }, colours[1], Rect::BorderStyle::inset); } else { @@ -5668,9 +5669,9 @@ namespace OpenRCT2::Ui::Windows screenCoords.y += 2 * kListRowHeight; // Horizontal rule - GfxFillRectInset( + Rect::fillInset( rt, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 303, -5 } }, colours[1], - RectBorderStyle::inset); + Rect::BorderStyle::inset); if (!(ride->lifecycleFlags & RIDE_LIFECYCLE_NO_RAW_STATS)) { @@ -6087,11 +6088,11 @@ namespace OpenRCT2::Ui::Windows { auto coord1 = ScreenCoordsXY{ x, rt.y }; auto coord2 = ScreenCoordsXY{ x, rt.y + rt.height - 1 }; - GfxFillRect(rt, { coord1, coord2 }, lightColour); - GfxFillRect(rt, { coord1 + ScreenCoordsXY{ 16, 0 }, coord2 + ScreenCoordsXY{ 16, 0 } }, darkColour); - GfxFillRect(rt, { coord1 + ScreenCoordsXY{ 32, 0 }, coord2 + ScreenCoordsXY{ 32, 0 } }, darkColour); - GfxFillRect(rt, { coord1 + ScreenCoordsXY{ 48, 0 }, coord2 + ScreenCoordsXY{ 48, 0 } }, darkColour); - GfxFillRect(rt, { coord1 + ScreenCoordsXY{ 64, 0 }, coord2 + ScreenCoordsXY{ 64, 0 } }, darkColour); + Rect::fill(rt, { coord1, coord2 }, lightColour); + Rect::fill(rt, { coord1 + ScreenCoordsXY{ 16, 0 }, coord2 + ScreenCoordsXY{ 16, 0 } }, darkColour); + Rect::fill(rt, { coord1 + ScreenCoordsXY{ 32, 0 }, coord2 + ScreenCoordsXY{ 32, 0 } }, darkColour); + Rect::fill(rt, { coord1 + ScreenCoordsXY{ 48, 0 }, coord2 + ScreenCoordsXY{ 48, 0 } }, darkColour); + Rect::fill(rt, { coord1 + ScreenCoordsXY{ 64, 0 }, coord2 + ScreenCoordsXY{ 64, 0 } }, darkColour); } time += 5; } @@ -6113,7 +6114,7 @@ namespace OpenRCT2::Ui::Windows { // Minor / major line int32_t colour = yUnit == 0 ? lightColour : darkColour; - GfxFillRect(rt, { { rt.x, y }, { rt.x + rt.width - 1, y } }, colour); + Rect::fill(rt, { { rt.x, y }, { rt.x + rt.width - 1, y } }, colour); int16_t scaled_yUnit = yUnit; // Scale modifier @@ -6197,7 +6198,7 @@ namespace OpenRCT2::Ui::Windows const bool previousMeasurement = x > measurement->current_item; // Draw the current line in grey. - GfxFillRect( + Rect::fill( rt, { { x, firstPoint }, { x, secondPoint } }, previousMeasurement ? PaletteIndex::pi17 : PaletteIndex::pi21); @@ -6211,7 +6212,7 @@ namespace OpenRCT2::Ui::Windows { const auto redLineTop = ScreenCoordsXY{ x, std::max(firstPoint, intensityThresholdNegative) }; const auto redLineBottom = ScreenCoordsXY{ x, std::max(secondPoint, intensityThresholdNegative) }; - GfxFillRect(rt, { redLineTop, redLineBottom }, redLineColour); + Rect::fill(rt, { redLineTop, redLineBottom }, redLineColour); } // Line exceeds positive threshold (at top of graph). @@ -6219,7 +6220,7 @@ namespace OpenRCT2::Ui::Windows { const auto redLineTop = ScreenCoordsXY{ x, std::min(firstPoint, intensityThresholdPositive) }; const auto redLineBottom = ScreenCoordsXY{ x, std::min(secondPoint, intensityThresholdPositive) }; - GfxFillRect(rt, { redLineTop, redLineBottom }, redLineColour); + Rect::fill(rt, { redLineTop, redLineBottom }, redLineColour); } } } diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index d035301ba2..b8e80eb270 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -30,6 +30,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr StringId kWindowTitle = kStringIdNone; @@ -621,7 +623,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; - GfxFillRect( + Rect::fill( rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width, rt.height } }, ColourMapA[colours[1].colour].mid_light); auto y = 0; @@ -637,7 +639,7 @@ namespace OpenRCT2::Ui::Windows if (i == static_cast(selectedListItem)) { // Background highlight - GfxFilterRect(rt, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::paletteDarken1); format = STR_WINDOW_COLOUR_2_STRINGID; if (_quickDemolishMode) format = STR_LIGHTPINK_STRINGID; diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index f09298b784..e94fd46854 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -36,6 +36,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr int32_t kInitialNumUnlockedScenarios = 5; @@ -288,8 +290,8 @@ namespace OpenRCT2::Ui::Windows auto startFrameX = width - (GetPreviewPaneWidth() / 2) - (image->width / 2) - kPadding; auto frameStartPos = ScreenCoordsXY(windowPos.x + startFrameX, screenPos.y + 15); auto frameEndPos = frameStartPos + ScreenCoordsXY(image->width + 1, image->height + 1); - GfxFillRectInset( - rt, { frameStartPos, frameEndPos }, colours[1], RectBorderStyle::inset, + Rect::fillInset( + rt, { frameStartPos, frameEndPos }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN | INSET_RECT_FLAG_FILL_MID_LIGHT); // Draw image, if available @@ -583,7 +585,7 @@ namespace OpenRCT2::Ui::Windows bool isHighlighted = _highlightedScenario == scenario; if (isHighlighted) { - GfxFilterRect(rt, { 0, y, width, y + scenarioItemHeight - 1 }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y, width, y + scenarioItemHeight - 1 }, FilterPaletteID::paletteDarken1); } bool isCompleted = scenario->Highscore != nullptr; diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 08970302b2..48e6308a24 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -65,6 +65,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr StringId kWindowTitle = kStringIdNone; @@ -1658,24 +1660,24 @@ namespace OpenRCT2::Ui::Windows { if (_selectedScenery == currentSceneryGlobal) { - GfxFillRectInset( + Rect::fillInset( rt, { topLeft, topLeft + ScreenCoordsXY{ kSceneryButtonWidth - 1, kSceneryButtonHeight - 1 } }, - colours[1], RectBorderStyle::outset, INSET_RECT_FLAG_FILL_MID_LIGHT); + colours[1], Rect::BorderStyle::outset, INSET_RECT_FLAG_FILL_MID_LIGHT); } } else { if (tabSelectedScenery == currentSceneryGlobal) { - GfxFillRectInset( + Rect::fillInset( rt, { topLeft, topLeft + ScreenCoordsXY{ kSceneryButtonWidth - 1, kSceneryButtonHeight - 1 } }, - colours[1], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_MID_LIGHT); + colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_MID_LIGHT); } else if (_selectedScenery == currentSceneryGlobal) { - GfxFillRectInset( + Rect::fillInset( rt, { topLeft, topLeft + ScreenCoordsXY{ kSceneryButtonWidth - 1, kSceneryButtonHeight - 1 } }, - colours[1], RectBorderStyle::outset, INSET_RECT_FLAG_FILL_MID_LIGHT); + colours[1], Rect::BorderStyle::outset, INSET_RECT_FLAG_FILL_MID_LIGHT); } } diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 259c62e632..06eaa7595b 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -29,6 +29,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr ScreenSize kMinimumWindowSize = { 500, 288 }; @@ -345,7 +347,7 @@ namespace OpenRCT2::Ui::Windows // Draw hover highlight if (highlighted) { - GfxFilterRect( + Rect::filter( rt, { 0, screenCoords.y, listWidgetWidth, screenCoords.y + kItemHeight }, FilterPaletteID::paletteDarken1); _version = serverDetails.Version; diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index c2a3c20732..8388d17638 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -20,6 +20,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { WindowBase* ResetShortcutKeysPromptOpen(); @@ -298,7 +300,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; - GfxFillRect( + Rect::fill( rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width - 1, rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); @@ -502,8 +504,8 @@ namespace OpenRCT2::Ui::Windows void DrawSeparator(RenderTarget& rt, int32_t y, int32_t scrollWidth) { const int32_t top = y + (kScrollableRowHeight / 2) - 1; - GfxFillRect(rt, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[1].colour].mid_dark); - GfxFillRect(rt, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[1].colour].lightest); + Rect::fill(rt, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[1].colour].mid_dark); + Rect::fill(rt, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[1].colour].lightest); } void DrawItem(RenderTarget& rt, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted) @@ -512,7 +514,7 @@ namespace OpenRCT2::Ui::Windows if (isHighlighted) { format = STR_WINDOW_COLOUR_2_STRINGID; - GfxFilterRect(rt, { 0, y - 1, scrollWidth, y + (kScrollableRowHeight - 2) }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y - 1, scrollWidth, y + (kScrollableRowHeight - 2) }, FilterPaletteID::paletteDarken1); } auto bindingOffset = (scrollWidth * 2) / 3; diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 159015c37f..c3fde0cd0b 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -45,6 +45,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { enum @@ -368,7 +370,7 @@ namespace OpenRCT2::Ui::Windows void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; - GfxFillRect( + Rect::fill( rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width - 1, rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); @@ -401,7 +403,7 @@ namespace OpenRCT2::Ui::Windows if (i == _highlightedIndex) { - GfxFilterRect(rt, { 0, y, 800, y + (kScrollableRowHeight - 1) }, FilterPaletteID::paletteDarken1); + Rect::filter(rt, { 0, y, 800, y + (kScrollableRowHeight - 1) }, FilterPaletteID::paletteDarken1); format = STR_WINDOW_COLOUR_2_STRINGID; if (_quickFireMode) diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index 8137a564b0..260434dd90 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -22,6 +22,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr ScreenSize kWindowSize = { 250, 90 }; @@ -224,11 +226,11 @@ namespace OpenRCT2::Ui::Windows u8string_view{ _buffer.data(), _buffer.size() }, kWindowSize.width - (24 + 13), FontStyle::Medium, &wrappedString, &no_lines); - GfxFillRectInset( + Rect::fillInset( rt, { { windowPos.x + 10, screenCoords.y }, { windowPos.x + kWindowSize.width - 10, screenCoords.y + 10 * (no_lines + 1) + 3 } }, - colours[1], RectBorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); + colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN); screenCoords.y += 1; @@ -268,7 +270,7 @@ namespace OpenRCT2::Ui::Windows { uint8_t colour = ColourMapA[colours[1].colour].mid_light; // TODO: palette index addition - GfxFillRect( + Rect::fill( rt, { { cursorX, screenCoords.y + 9 }, { cursorX + textWidth, screenCoords.y + 9 } }, colour + 5); } diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 7820fa29a6..4b6f762861 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -24,6 +24,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { enum @@ -720,7 +722,7 @@ namespace OpenRCT2::Ui::Windows return; if (!colours[1].hasFlag(ColourFlag::translucent)) - // GfxFillRect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, + // Rect::fill(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, // ColourMapA[colours[1].colour].mid_light); GfxClear(rt, ColourMapA[colours[1].colour].mid_light); screenCoords.y = 0; @@ -761,16 +763,16 @@ namespace OpenRCT2::Ui::Windows { TranslucentWindowPalette windowPalette = kTranslucentWindowPalettes[colour.colour]; - GfxFilterRect(rt, { leftTop, rightBottom }, windowPalette.highlight); - GfxFilterRect(rt, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, windowPalette.shadow); + Rect::filter(rt, { leftTop, rightBottom }, windowPalette.highlight); + Rect::filter(rt, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, windowPalette.shadow); } else { colour = ColourMapA[colours[1].colour].mid_dark; - GfxFillRect(rt, { leftTop, rightBottom }, colour.colour); + Rect::fill(rt, { leftTop, rightBottom }, colour.colour); colour = ColourMapA[colours[1].colour].lightest; - GfxFillRect(rt, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, colour.colour); + Rect::fill(rt, { leftTop + yPixelOffset, rightBottom + yPixelOffset }, colour.colour); } } @@ -794,8 +796,8 @@ namespace OpenRCT2::Ui::Windows ScreenCoordsXY topLeft{ _check_offset_x, screenCoords.y + _check_offset_y + _button_size * j }; ScreenCoordsXY bottomRight{ _check_offset_x + 10, screenCoords.y + _check_offset_y + 11 + _button_size * j }; - GfxFillRectInset( - rt, { topLeft, bottomRight }, colours[1], RectBorderStyle::inset, + Rect::fillInset( + rt, { topLeft, bottomRight }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN | INSET_RECT_FLAG_FILL_MID_LIGHT); if (colour.hasFlag(ColourFlag::translucent)) { diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 79fb528db6..44c313565c 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -55,6 +55,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr StringId EntranceTypeStringIds[] = { @@ -1585,7 +1587,7 @@ static uint64_t PageDisabledWidgets[] = { void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { const int32_t listWidth = widgets[WIDX_LIST].width(); - GfxFillRect( + Rect::fill( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); // Show usage hint when nothing is selected @@ -1620,12 +1622,12 @@ static uint64_t PageDisabledWidgets[] = { auto fillRectangle = ScreenRect{ { 0, screenCoords.y }, { listWidth, screenCoords.y + kScrollableRowHeight - 1 } }; if (selectedRow) - GfxFillRect(rt, fillRectangle, ColourMapA[colours[1].colour].mid_dark); + Rect::fill(rt, fillRectangle, ColourMapA[colours[1].colour].mid_dark); else if (hoveredRow) - GfxFillRect(rt, fillRectangle, ColourMapA[colours[1].colour].mid_dark | 0x1000000); + Rect::fill(rt, fillRectangle, ColourMapA[colours[1].colour].mid_dark | 0x1000000); // Zebra stripes else if (((windowTileInspectorElementCount - i) & 1) == 0) - GfxFillRect(rt, fillRectangle, ColourMapA[colours[1].colour].light | 0x1000000); + Rect::fill(rt, fillRectangle, ColourMapA[colours[1].colour].light | 0x1000000); StringId stringFormat = STR_WINDOW_COLOUR_2_STRINGID; if (selectedRow || hoveredRow) @@ -1636,8 +1638,8 @@ static uint64_t PageDisabledWidgets[] = { checkboxFormatter.Add(kCheckMarkString); // Draw checkbox and check if visible - GfxFillRectInset( - rt, { { 2, screenCoords.y }, { 15, screenCoords.y + 11 } }, colours[1], RectBorderStyle::inset, + Rect::fillInset( + rt, { { 2, screenCoords.y }, { 15, screenCoords.y + 11 } }, colours[1], Rect::BorderStyle::inset, INSET_RECT_FLAG_FILL_DONT_LIGHTEN | INSET_RECT_FLAG_FILL_MID_LIGHT); if (!tileElement->IsInvisible()) { diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 5890a8a0ae..7b14026e11 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -25,6 +25,8 @@ namespace OpenRCT2::Ui::Windows { + using namespace OpenRCT2::Drawing; + enum { WIDX_START_NEW_GAME, @@ -274,7 +276,7 @@ namespace OpenRCT2::Ui::Windows void onDraw(RenderTarget& rt) override { - GfxFilterRect(rt, _filterRect, FilterPaletteID::palette51); + Rect::filter(rt, _filterRect, FilterPaletteID::palette51); drawWidgets(rt); } }; diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index 20439c132d..c34fdc492c 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -19,6 +19,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { enum @@ -109,14 +111,14 @@ namespace OpenRCT2::Ui::Windows int32_t bottom = windowPos.y + height - 1; // Background - GfxFilterRect(rt, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::palette45); - GfxFilterRect(rt, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::paletteGlassLightOrange); + Rect::filter(rt, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::palette45); + Rect::filter(rt, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::paletteGlassLightOrange); // Sides - GfxFilterRect(rt, { { left + 0, top + 2 }, { left + 0, bottom - 2 } }, FilterPaletteID::paletteDarken3); - GfxFilterRect(rt, { { right + 0, top + 2 }, { right + 0, bottom - 2 } }, FilterPaletteID::paletteDarken3); - GfxFilterRect(rt, { { left + 2, bottom + 0 }, { right - 2, bottom + 0 } }, FilterPaletteID::paletteDarken3); - GfxFilterRect(rt, { { left + 2, top + 0 }, { right - 2, top + 0 } }, FilterPaletteID::paletteDarken3); + Rect::filter(rt, { { left + 0, top + 2 }, { left + 0, bottom - 2 } }, FilterPaletteID::paletteDarken3); + Rect::filter(rt, { { right + 0, top + 2 }, { right + 0, bottom - 2 } }, FilterPaletteID::paletteDarken3); + Rect::filter(rt, { { left + 2, bottom + 0 }, { right - 2, bottom + 0 } }, FilterPaletteID::paletteDarken3); + Rect::filter(rt, { { left + 2, top + 0 }, { right - 2, top + 0 } }, FilterPaletteID::paletteDarken3); // Corners GfxFilterPixel(rt, { left + 1, top + 1 }, FilterPaletteID::paletteDarken3); diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 68a6ca523d..ca660bd2da 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -29,6 +29,8 @@ #include #include +using namespace OpenRCT2::Drawing; + namespace OpenRCT2::Ui::Windows { static constexpr StringId kWindowTitle = STR_SELECT_DESIGN; @@ -483,7 +485,7 @@ namespace OpenRCT2::Ui::Windows } auto screenPos = windowPos + ScreenCoordsXY{ tdWidget.left + 1, tdWidget.top + 1 }; - GfxFillRect(rt, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour); // TODO Check dpi + Rect::fill(rt, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour); // TODO Check dpi if (_loadedTrackDesignIndex != trackIndex) { @@ -694,7 +696,7 @@ namespace OpenRCT2::Ui::Windows if (listIndex == static_cast(selectedListItem)) { // Highlight - GfxFilterRect( + Rect::filter( rt, { screenCoords, { width, screenCoords.y + kScrollableRowHeight - 1 } }, FilterPaletteID::paletteDarken1); stringId = STR_WINDOW_COLOUR_2_STRINGID; @@ -719,7 +721,7 @@ namespace OpenRCT2::Ui::Windows if (listIndex == static_cast(selectedListItem)) { // Highlight - GfxFilterRect( + Rect::filter( rt, { screenCoords, { width, screenCoords.y + kScrollableRowHeight - 1 } }, FilterPaletteID::paletteDarken1); stringId = STR_WINDOW_COLOUR_2_STRINGID; diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index b175837108..a9593a1141 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -683,7 +683,7 @@ void MaskFn( void GfxFilterPixel(RenderTarget& rt, const ScreenCoordsXY& coords, FilterPaletteID palette) { - GfxFilterRect(rt, { coords, coords }, palette); + Rect::filter(rt, { coords, coords }, palette); } /** diff --git a/src/openrct2/drawing/Rect.cpp b/src/openrct2/drawing/Rect.cpp index c35a551743..949ca74d79 100644 --- a/src/openrct2/drawing/Rect.cpp +++ b/src/openrct2/drawing/Rect.cpp @@ -17,134 +17,137 @@ using OpenRCT2::Drawing::IDrawingContext; -void GfxFillRect(RenderTarget& rt, const ScreenRect& rect, int32_t colour) +namespace OpenRCT2::Drawing::Rect { - auto drawingEngine = rt.DrawingEngine; - if (drawingEngine != nullptr) + void fill(RenderTarget& rt, const ScreenRect& rect, int32_t colour) { - IDrawingContext* dc = drawingEngine->GetDrawingContext(); - dc->FillRect(rt, colour, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); - } -} - -/** - * Draw a rectangle, with optional border or fill - * - * rct2: 0x006E6F81 - * dpi (edi) - * left (ax) - * top (cx) - * right (bx) - * bottom (dx) - * colour (ebp) - * flags (si) - */ -void GfxFillRectInset( - RenderTarget& rt, const ScreenRect& rect, ColourWithFlags colour, RectBorderStyle borderStyle, uint8_t flags) -{ - const auto leftTop = ScreenCoordsXY{ rect.GetLeft(), rect.GetTop() }; - const auto leftBottom = ScreenCoordsXY{ rect.GetLeft(), rect.GetBottom() }; - const auto rightTop = ScreenCoordsXY{ rect.GetRight(), rect.GetTop() }; - const auto rightBottom = ScreenCoordsXY{ rect.GetRight(), rect.GetBottom() }; - if (colour.hasFlag(ColourFlag::translucent)) - { - auto palette = kTranslucentWindowPalettes[colour.colour]; - - switch (borderStyle) + auto drawingEngine = rt.DrawingEngine; + if (drawingEngine != nullptr) { - case RectBorderStyle::none: - GfxFilterRect(rt, rect, palette.base); - break; - - case RectBorderStyle::inset: - // Draw outline of box - GfxFilterRect(rt, { leftTop, leftBottom }, palette.highlight); - GfxFilterRect(rt, { leftTop, rightTop }, palette.highlight); - GfxFilterRect(rt, { rightTop, rightBottom }, palette.shadow); - GfxFilterRect(rt, { leftBottom, rightBottom }, palette.shadow); - - if (!(flags & INSET_RECT_FLAG_FILL_NONE)) - { - GfxFilterRect(rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, palette.base); - } - break; - - case RectBorderStyle::outset: - // Draw outline of box - GfxFilterRect(rt, { leftTop, leftBottom }, palette.shadow); - GfxFilterRect(rt, { leftTop, rightTop }, palette.shadow); - GfxFilterRect(rt, { rightTop, rightBottom }, palette.highlight); - GfxFilterRect(rt, { leftBottom, rightBottom }, palette.highlight); - - if (!(flags & INSET_RECT_FLAG_FILL_NONE)) - { - GfxFilterRect( - rt, { leftTop + ScreenCoordsXY{ 1, 1 }, { rightBottom - ScreenCoordsXY{ 1, 1 } } }, palette.base); - } - break; + IDrawingContext* dc = drawingEngine->GetDrawingContext(); + dc->FillRect(rt, colour, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); } } - else + + /** + * Draw a rectangle, with optional border or fill + * + * rct2: 0x006E6F81 + * dpi (edi) + * left (ax) + * top (cx) + * right (bx) + * bottom (dx) + * colour (ebp) + * flags (si) + */ + void fillInset(RenderTarget& rt, const ScreenRect& rect, ColourWithFlags colour, BorderStyle borderStyle, uint8_t flags) { - uint8_t shadow, fill, hilight; - if (flags & INSET_RECT_FLAG_FILL_MID_LIGHT) + const auto leftTop = ScreenCoordsXY{ rect.GetLeft(), rect.GetTop() }; + const auto leftBottom = ScreenCoordsXY{ rect.GetLeft(), rect.GetBottom() }; + const auto rightTop = ScreenCoordsXY{ rect.GetRight(), rect.GetTop() }; + const auto rightBottom = ScreenCoordsXY{ rect.GetRight(), rect.GetBottom() }; + if (colour.hasFlag(ColourFlag::translucent)) { - shadow = ColourMapA[colour.colour].dark; - fill = ColourMapA[colour.colour].mid_light; - hilight = ColourMapA[colour.colour].lighter; + auto palette = kTranslucentWindowPalettes[colour.colour]; + + switch (borderStyle) + { + case BorderStyle::none: + Rect::filter(rt, rect, palette.base); + break; + + case BorderStyle::inset: + // Draw outline of box + Rect::filter(rt, { leftTop, leftBottom }, palette.highlight); + Rect::filter(rt, { leftTop, rightTop }, palette.highlight); + Rect::filter(rt, { rightTop, rightBottom }, palette.shadow); + Rect::filter(rt, { leftBottom, rightBottom }, palette.shadow); + + if (!(flags & INSET_RECT_FLAG_FILL_NONE)) + { + Rect::filter( + rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, palette.base); + } + break; + + case BorderStyle::outset: + // Draw outline of box + Rect::filter(rt, { leftTop, leftBottom }, palette.shadow); + Rect::filter(rt, { leftTop, rightTop }, palette.shadow); + Rect::filter(rt, { rightTop, rightBottom }, palette.highlight); + Rect::filter(rt, { leftBottom, rightBottom }, palette.highlight); + + if (!(flags & INSET_RECT_FLAG_FILL_NONE)) + { + Rect::filter( + rt, { leftTop + ScreenCoordsXY{ 1, 1 }, { rightBottom - ScreenCoordsXY{ 1, 1 } } }, palette.base); + } + break; + } } else { - shadow = ColourMapA[colour.colour].mid_dark; - fill = ColourMapA[colour.colour].light; - hilight = ColourMapA[colour.colour].lighter; - } + uint8_t shadow, fill, hilight; + if (flags & INSET_RECT_FLAG_FILL_MID_LIGHT) + { + shadow = ColourMapA[colour.colour].dark; + fill = ColourMapA[colour.colour].mid_light; + hilight = ColourMapA[colour.colour].lighter; + } + else + { + shadow = ColourMapA[colour.colour].mid_dark; + fill = ColourMapA[colour.colour].light; + hilight = ColourMapA[colour.colour].lighter; + } - switch (borderStyle) - { - case RectBorderStyle::none: - GfxFillRect(rt, rect, fill); - break; + switch (borderStyle) + { + case BorderStyle::none: + Rect::fill(rt, rect, fill); + break; - case RectBorderStyle::inset: - // Draw outline of box - GfxFillRect(rt, { leftTop, leftBottom }, shadow); - GfxFillRect(rt, { leftTop + ScreenCoordsXY{ 1, 0 }, rightTop }, shadow); - GfxFillRect(rt, { rightTop + ScreenCoordsXY{ 0, 1 }, rightBottom - ScreenCoordsXY{ 0, 1 } }, hilight); - GfxFillRect(rt, { leftBottom + ScreenCoordsXY{ 1, 0 }, rightBottom }, hilight); + case BorderStyle::inset: + // Draw outline of box + Rect::fill(rt, { leftTop, leftBottom }, shadow); + Rect::fill(rt, { leftTop + ScreenCoordsXY{ 1, 0 }, rightTop }, shadow); + Rect::fill(rt, { rightTop + ScreenCoordsXY{ 0, 1 }, rightBottom - ScreenCoordsXY{ 0, 1 } }, hilight); + Rect::fill(rt, { leftBottom + ScreenCoordsXY{ 1, 0 }, rightBottom }, hilight); - if (!(flags & INSET_RECT_FLAG_FILL_NONE)) - { - if (!(flags & INSET_RECT_FLAG_FILL_DONT_LIGHTEN)) + if (!(flags & INSET_RECT_FLAG_FILL_NONE)) { - fill = ColourMapA[colour.colour].lighter; + if (!(flags & INSET_RECT_FLAG_FILL_DONT_LIGHTEN)) + { + fill = ColourMapA[colour.colour].lighter; + } + Rect::fill(rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, fill); } - GfxFillRect(rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, fill); - } - break; + break; - case RectBorderStyle::outset: - // Draw outline of box - GfxFillRect(rt, { leftTop, leftBottom - ScreenCoordsXY{ 0, 1 } }, hilight); - GfxFillRect(rt, { leftTop + ScreenCoordsXY{ 1, 0 }, rightTop - ScreenCoordsXY{ 1, 0 } }, hilight); - GfxFillRect(rt, { rightTop, rightBottom - ScreenCoordsXY{ 0, 1 } }, shadow); - GfxFillRect(rt, { leftBottom, rightBottom }, shadow); + case BorderStyle::outset: + // Draw outline of box + Rect::fill(rt, { leftTop, leftBottom - ScreenCoordsXY{ 0, 1 } }, hilight); + Rect::fill(rt, { leftTop + ScreenCoordsXY{ 1, 0 }, rightTop - ScreenCoordsXY{ 1, 0 } }, hilight); + Rect::fill(rt, { rightTop, rightBottom - ScreenCoordsXY{ 0, 1 } }, shadow); + Rect::fill(rt, { leftBottom, rightBottom }, shadow); - if (!(flags & INSET_RECT_FLAG_FILL_NONE)) - { - GfxFillRect(rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, fill); - } - break; + if (!(flags & INSET_RECT_FLAG_FILL_NONE)) + { + Rect::fill(rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, fill); + } + break; + } } } -} -void GfxFilterRect(RenderTarget& rt, const ScreenRect& rect, FilterPaletteID palette) -{ - auto drawingEngine = rt.DrawingEngine; - if (drawingEngine != nullptr) + void filter(RenderTarget& rt, const ScreenRect& rect, FilterPaletteID palette) { - IDrawingContext* dc = drawingEngine->GetDrawingContext(); - dc->FilterRect(rt, palette, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); + auto drawingEngine = rt.DrawingEngine; + if (drawingEngine != nullptr) + { + IDrawingContext* dc = drawingEngine->GetDrawingContext(); + dc->FilterRect(rt, palette, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); + } } -} +} // namespace OpenRCT2::Drawing::Rect diff --git a/src/openrct2/drawing/Rect.h b/src/openrct2/drawing/Rect.h index 4ac11373f7..9bd39751cc 100644 --- a/src/openrct2/drawing/Rect.h +++ b/src/openrct2/drawing/Rect.h @@ -16,16 +16,18 @@ enum class FilterPaletteID : int32_t; struct RenderTarget; struct ScreenRect; -void GfxFillRect(RenderTarget& rt, const ScreenRect& rect, int32_t colour); - -enum class RectBorderStyle : uint8_t +namespace OpenRCT2::Drawing::Rect { - outset, - inset, - none, -}; + enum class BorderStyle : uint8_t + { + outset, + inset, + none, + }; -void GfxFillRectInset( - RenderTarget& rt, const ScreenRect& rect, ColourWithFlags colour, RectBorderStyle borderStyle = RectBorderStyle::outset, - uint8_t flags = 0); -void GfxFilterRect(RenderTarget& rt, const ScreenRect& rect, FilterPaletteID palette); + void fill(RenderTarget& rt, const ScreenRect& rect, int32_t colour); + void fillInset( + RenderTarget& rt, const ScreenRect& rect, ColourWithFlags colour, BorderStyle borderStyle = BorderStyle::outset, + uint8_t flags = 0); + void filter(RenderTarget& rt, const ScreenRect& rect, FilterPaletteID palette); +} // namespace OpenRCT2::Drawing::Rect diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index 89a3ff7ef2..a0c8ff9293 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -16,6 +16,7 @@ #include "Drawing.h" using namespace OpenRCT2; +using namespace OpenRCT2::Drawing; class StaticLayout { @@ -99,12 +100,12 @@ void DrawText(RenderTarget& rt, const ScreenCoordsXY& coords, const TextPaint& p if (paint.UnderlineText == TextUnderline::On) { - GfxFillRect( + Rect::fill( rt, { { alignedCoords + ScreenCoordsXY{ 0, 11 } }, { alignedCoords + ScreenCoordsXY{ width, 11 } } }, gTextPalette[1]); if (gTextPalette[2] != 0) { - GfxFillRect( + Rect::fill( rt, { { alignedCoords + ScreenCoordsXY{ 1, 12 } }, { alignedCoords + ScreenCoordsXY{ width + 1, 12 } } }, gTextPalette[2]); } diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index 129dc6ff6d..1cfce47ba7 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -25,6 +25,7 @@ using namespace OpenRCT2; using namespace OpenRCT2::Audio; +using namespace OpenRCT2::Drawing; bool gChatOpen = false; static u8string _chatCurrentLine; @@ -139,19 +140,19 @@ void ChatDraw(RenderTarget& rt, ColourWithFlags chatBackgroundColor) ScreenCoordsXY bottomLeft{ _chatLeft, _chatBottom }; GfxSetDirtyBlocks( { topLeft - ScreenCoordsXY{ 0, 5 }, bottomRight + ScreenCoordsXY{ 0, 5 } }); // Background area + Textbox - GfxFilterRect( + Rect::filter( rt, { topLeft - ScreenCoordsXY{ 0, 5 }, bottomRight + ScreenCoordsXY{ 0, 5 } }, FilterPaletteID::palette51); // Opaque grey background - GfxFillRectInset( + Rect::fillInset( rt, { topLeft - ScreenCoordsXY{ 0, 5 }, bottomRight + ScreenCoordsXY{ 0, 5 } }, chatBackgroundColor, - RectBorderStyle::outset, INSET_RECT_FLAG_FILL_NONE); - GfxFillRectInset( + Rect::BorderStyle::outset, INSET_RECT_FLAG_FILL_NONE); + Rect::fillInset( rt, { topLeft + ScreenCoordsXY{ 1, -4 }, bottomRight - ScreenCoordsXY{ 1, inputLineHeight + 6 } }, - chatBackgroundColor, RectBorderStyle::inset); - GfxFillRectInset( + chatBackgroundColor, Rect::BorderStyle::inset); + Rect::fillInset( rt, { bottomLeft + ScreenCoordsXY{ 1, -inputLineHeight - 5 }, bottomRight + ScreenCoordsXY{ -1, 4 } }, chatBackgroundColor, - RectBorderStyle::inset); // Textbox + Rect::BorderStyle::inset); // Textbox } auto screenCoords = ScreenCoordsXY{ _chatLeft + 5, _chatBottom - inputLineHeight - 20 }; @@ -203,7 +204,7 @@ void ChatDraw(RenderTarget& rt, ColourWithFlags chatBackgroundColor) int32_t caretX = screenCoords.x + GfxGetStringWidth(lineBuffer, FontStyle::Medium); int32_t caretY = screenCoords.y + 14; - GfxFillRect(rt, { { caretX, caretY }, { caretX + 6, caretY + 1 } }, PaletteIndex::pi56); + Rect::fill(rt, { { caretX, caretY }, { caretX + 6, caretY + 1 } }, PaletteIndex::pi56); } } } diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 7f4c7617fe..9a5b88aa41 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -54,6 +54,7 @@ namespace OpenRCT2 { + using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Numerics; enum : uint8_t @@ -1037,7 +1038,7 @@ namespace OpenRCT2 auto y = rt.y; auto w = rt.width; auto h = rt.height; - GfxFilterRect(rt, ScreenRect(x, y, x + w, y + h), paletteId); + Rect::filter(rt, ScreenRect(x, y, x + w, y + h), paletteId); } } diff --git a/src/openrct2/scenes/intro/IntroScene.cpp b/src/openrct2/scenes/intro/IntroScene.cpp index bef28d1f32..3c2e436fa9 100644 --- a/src/openrct2/scenes/intro/IntroScene.cpp +++ b/src/openrct2/scenes/intro/IntroScene.cpp @@ -22,6 +22,7 @@ #include using OpenRCT2::Audio::SoundId; +using namespace OpenRCT2::Drawing; namespace OpenRCT2 { @@ -202,7 +203,7 @@ namespace OpenRCT2 GfxClear(rt, kBackgroundColourDark); // Draw a white rectangle for the logo background (gives a bit of white margin) - GfxFillRect( + Rect::fill( rt, { { (screenWidth / 2) - 320 + 50, _introStateCounter + 50 }, { (screenWidth / 2) - 320 + 50 + 540, _introStateCounter + 50 + 425 } },