1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 06:23:04 +01:00

Use dpi ref in rect and line drawing functions

This commit is contained in:
Gymnasiast
2023-04-03 23:16:34 +02:00
committed by duncanspumpkin
parent 2941f6f7a5
commit bb83a80eab
47 changed files with 276 additions and 278 deletions

View File

@@ -292,18 +292,18 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
Invalidate();
// Give console area a translucent effect.
GfxFilterRect(&dpi, { _consoleTopLeft, _consoleBottomRight }, FilterPaletteID::Palette51);
GfxFilterRect(dpi, { _consoleTopLeft, _consoleBottomRight }, FilterPaletteID::Palette51);
// Make input area more opaque.
GfxFilterRect(
&dpi, { { _consoleTopLeft.x, _consoleBottomRight.y - lineHeight - 10 }, _consoleBottomRight - ScreenCoordsXY{ 0, 1 } },
dpi, { { _consoleTopLeft.x, _consoleBottomRight.y - lineHeight - 10 }, _consoleBottomRight - ScreenCoordsXY{ 0, 1 } },
FilterPaletteID::Palette51);
// Paint background colour.
uint8_t backgroundColour = ThemeGetColour(WindowClass::Console, 0);
GfxFillRectInset(&dpi, { _consoleTopLeft, _consoleBottomRight }, backgroundColour, INSET_RECT_FLAG_FILL_NONE);
GfxFillRectInset(dpi, { _consoleTopLeft, _consoleBottomRight }, backgroundColour, INSET_RECT_FLAG_FILL_NONE);
GfxFillRectInset(
&dpi, { _consoleTopLeft + ScreenCoordsXY{ 1, 1 }, _consoleBottomRight - ScreenCoordsXY{ 1, 1 } }, backgroundColour,
dpi, { _consoleTopLeft + ScreenCoordsXY{ 1, 1 }, _consoleBottomRight - ScreenCoordsXY{ 1, 1 } }, backgroundColour,
INSET_RECT_FLAG_BORDER_INSET);
std::string lineBuffer;
@@ -329,7 +329,7 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
{
auto caret = screenCoords + ScreenCoordsXY{ _caretScreenPosX, lineHeight };
uint8_t caretColour = ColourMapA[BASE_COLOUR(textColour)].lightest;
GfxFillRect(&dpi, { caret, caret + ScreenCoordsXY{ CONSOLE_CARET_WIDTH, 1 } }, caretColour);
GfxFillRect(dpi, { caret, caret + ScreenCoordsXY{ CONSOLE_CARET_WIDTH, 1 } }, caretColour);
}
// What about border colours?
@@ -338,21 +338,21 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
// Input area top border
GfxFillRect(
&dpi,
dpi,
{ { _consoleTopLeft.x, _consoleBottomRight.y - lineHeight - 11 },
{ _consoleBottomRight.x, _consoleBottomRight.y - lineHeight - 11 } },
borderColour1);
GfxFillRect(
&dpi,
dpi,
{ { _consoleTopLeft.x, _consoleBottomRight.y - lineHeight - 10 },
{ _consoleBottomRight.x, _consoleBottomRight.y - lineHeight - 10 } },
borderColour2);
// Input area bottom border
GfxFillRect(
&dpi, { { _consoleTopLeft.x, _consoleBottomRight.y - 1 }, { _consoleBottomRight.x, _consoleBottomRight.y - 1 } },
dpi, { { _consoleTopLeft.x, _consoleBottomRight.y - 1 }, { _consoleBottomRight.x, _consoleBottomRight.y - 1 } },
borderColour1);
GfxFillRect(&dpi, { { _consoleTopLeft.x, _consoleBottomRight.y }, _consoleBottomRight }, borderColour2);
GfxFillRect(dpi, { { _consoleTopLeft.x, _consoleBottomRight.y }, _consoleBottomRight }, borderColour2);
}
// Calculates the amount of visible lines, based on the console size, excluding the input line.