MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / drawText

Function drawText

src/OpenLoco/src/Ui/Widgets/DropdownWidget.cpp:11–36  ·  view source on GitHub ↗

0x4CB2D6

Source from the content-addressed store, hash-verified

9{
10 // 0x4CB2D6
11 static void drawText(Gfx::DrawingContext& drawingCtx, const Widget& widget, const WidgetState& widgetStated)
12 {
13 if (widget.content == Widget::kContentNull || widget.content == Widget::kContentUnk)
14 {
15 return;
16 }
17
18 auto colour = widgetStated.colour;
19 if (widgetStated.disabled)
20 {
21 colour = colour.inset();
22 }
23 else
24 {
25 colour = colour.FD();
26 }
27
28 auto* window = widgetStated.window;
29
30 const auto pos = window->position() + widget.position();
31 const auto size = widget.size();
32
33 auto tr = Gfx::TextRenderer(drawingCtx);
34 auto formatArgs = FormatArgumentsView(widget.textArgs);
35 tr.drawStringLeftClipped(pos + Ui::Point{ 1, 1 }, size.width - 2, colour, widget.text, formatArgs);
36 }
37
38 // 0x004CB164
39 void ComboBox::draw(Gfx::DrawingContext& drawingCtx, const Widget& widget, const WidgetState& widgetState)

Callers 1

drawMethod · 0.70

Calls 7

TextRendererClass · 0.85
FormatArgumentsViewClass · 0.85
insetMethod · 0.80
FDMethod · 0.80
drawStringLeftClippedMethod · 0.80
positionMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected