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

Method draw

src/OpenLoco/src/Ui/Widgets/ImageButtonWidget.cpp:105–142  ·  view source on GitHub ↗

0x004CB164

Source from the content-addressed store, hash-verified

103
104 // 0x004CB164
105 void ImageButton::draw(Gfx::DrawingContext& drawingCtx, const Widget& widget, const WidgetState& widgetState)
106 {
107 if (!widgetState.disabled && widgetState.hovered)
108 {
109 // TODO: Fix mixed windows
110 draw_3(drawingCtx, widget, widgetState);
111 return;
112 }
113
114 auto* window = widgetState.window;
115
116 const auto pos = window->position() + widget.position();
117 const auto size = widget.size();
118
119 if (widgetState.activated)
120 {
121 auto flags = widgetState.flags;
122 flags |= Gfx::RectInsetFlags::borderInset;
123 if (widget.content == Widget::kContentUnk)
124 {
125 // 0x004CABE8
126
127 flags |= Gfx::RectInsetFlags::fillNone;
128 drawingCtx.fillRectInset(pos, size, widgetState.colour, flags);
129
130 return;
131 }
132
133 drawingCtx.fillRectInset(pos, size, widgetState.colour, flags);
134 }
135
136 if (widget.content == Widget::kContentNull)
137 {
138 return;
139 }
140
141 drawImage(drawingCtx, widget, widgetState);
142 }
143}

Callers

nothing calls this directly

Calls 5

draw_3Function · 0.85
drawImageFunction · 0.70
positionMethod · 0.45
sizeMethod · 0.45
fillRectInsetMethod · 0.45

Tested by

no test coverage detected