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

Function WidgetFrameDraw

src/openrct2-ui/interface/Widget.cpp:142–168  ·  view source on GitHub ↗

* * rct2: 0x006EB6CE */

Source from the content-addressed store, hash-verified

140 * rct2: 0x006EB6CE
141 */
142 static void WidgetFrameDraw(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex)
143 {
144 // Get the widget
145 const auto& widget = w.widgets[widgetIndex];
146
147 // Resolve the absolute ltrb
148 auto leftTop = w.windowPos + ScreenCoordsXY{ widget.left, widget.top };
149 int32_t r = w.windowPos.x + widget.right;
150 int32_t b = w.windowPos.y + widget.bottom;
151
152 //
153 auto brightness
154 = (w.flags.has(WindowFlag::higherContrastOnPress) ? Rectangle::FillBrightness::dark
155 : Rectangle::FillBrightness::light);
156
157 auto colour = w.colours[widget.colour];
158
159 // Draw the frame
160 Rectangle::fillInset(rt, { leftTop, { r, b } }, colour, Rectangle::BorderStyle::outset, brightness);
161
162 if (!w.canBeResized())
163 return;
164
165 // Draw the resize sprite at the bottom right corner
166 leftTop = w.windowPos + ScreenCoordsXY{ widget.right - 18, widget.bottom - 18 };
167 GfxDrawSprite(rt, ImageId(SPR_RESIZE, colour.colour), leftTop);
168 }
169
170 /**
171 *

Callers 1

widgetDrawFunction · 0.85

Calls 5

fillInsetFunction · 0.85
GfxDrawSpriteFunction · 0.85
canBeResizedMethod · 0.80
ImageIdClass · 0.70
hasMethod · 0.65

Tested by

no test coverage detected