MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / onDraw

Method onDraw

src/openrct2-ui/windows/Tooltip.cpp:109–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107 }
108
109 void onDraw(RenderTarget& rt) override
110 {
111 int32_t left = windowPos.x;
112 int32_t top = windowPos.y;
113 int32_t right = windowPos.x + width - 1;
114 int32_t bottom = windowPos.y + height - 1;
115
116 // Background
117 Rectangle::filter(rt, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::palette45);
118 Rectangle::filter(
119 rt, { { left + 1, top + 1 }, { right - 1, bottom - 1 } }, FilterPaletteID::paletteGlassLightOrange);
120
121 // Sides
122 Rectangle::filter(rt, { { left + 0, top + 2 }, { left + 0, bottom - 2 } }, FilterPaletteID::paletteDarken3);
123 Rectangle::filter(rt, { { right + 0, top + 2 }, { right + 0, bottom - 2 } }, FilterPaletteID::paletteDarken3);
124 Rectangle::filter(rt, { { left + 2, bottom + 0 }, { right - 2, bottom + 0 } }, FilterPaletteID::paletteDarken3);
125 Rectangle::filter(rt, { { left + 2, top + 0 }, { right - 2, top + 0 } }, FilterPaletteID::paletteDarken3);
126
127 // Corners
128 GfxFilterPixel(rt, { left + 1, top + 1 }, FilterPaletteID::paletteDarken3);
129 GfxFilterPixel(rt, { right - 1, top + 1 }, FilterPaletteID::paletteDarken3);
130 GfxFilterPixel(rt, { left + 1, bottom - 1 }, FilterPaletteID::paletteDarken3);
131 GfxFilterPixel(rt, { right - 1, bottom - 1 }, FilterPaletteID::paletteDarken3);
132
133 // Text
134 left = windowPos.x + ((width + 1) / 2) - 1;
135 top = windowPos.y + 1;
136 drawStringCentredRaw(rt, { left, top }, _tooltipNumLines, _tooltipText.data(), FontStyle::small);
137 }
138
139 private:
140 // Returns the width of the new tooltip text

Callers

nothing calls this directly

Calls 4

filterFunction · 0.85
GfxFilterPixelFunction · 0.85
drawStringCentredRawFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected