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

Function draw

src/OpenLoco/src/Ui/Windows/Error.cpp:186–222  ·  view source on GitHub ↗

0x00431C05

Source from the content-addressed store, hash-verified

184 {
185 // 0x00431C05
186 static void draw(Ui::Window& self, Gfx::DrawingContext& drawingCtx)
187 {
188 self.draw(drawingCtx);
189
190 auto tr = Gfx::TextRenderer(drawingCtx);
191 auto colour = AdvancedColour(Colour::white).translucent(); // self.colours[0];
192
193 if (_errorCompetitorId == CompanyId::null)
194 {
195 uint16_t xPos = self.x + self.width / 2;
196 uint16_t yPos = self.y + kPadding;
197
198 tr.drawStringCentredRaw(Point(xPos, yPos), _linebreakCount, colour, &_errorText[0]);
199 }
200 else
201 {
202 auto xPos = self.x + self.widgets[ErrorCompetitor::widx::innerFrame].left;
203 auto yPos = self.y + self.widgets[ErrorCompetitor::widx::innerFrame].top;
204
205 auto company = CompanyManager::get(_errorCompetitorId);
206 auto companyObj = ObjectManager::get<CompetitorObject>(company->competitorId);
207
208 auto imageId = companyObj->images[enumValue(company->ownerEmotion)];
209 imageId = Gfx::recolour(imageId, company->mainColours.primary);
210 imageId++;
211
212 drawingCtx.drawImage(xPos, yPos, imageId);
213
214 if (company->jailStatus != 0)
215 {
216 drawingCtx.drawImage(xPos, yPos, ImageIds::owner_jailed);
217 }
218
219 auto point = Point(self.x + (self.width - kCompetitorSize) / 2 + kCompetitorSize + kPadding, self.y + 20);
220 tr.drawStringCentredRaw(point, _linebreakCount, colour, &_errorText[0]);
221 }
222 }
223
224 // 0x00431E1B
225 static void onPeriodicUpdate(Ui::Window& self)

Callers

nothing calls this directly

Calls 9

TextRendererClass · 0.85
enumValueFunction · 0.85
recolourFunction · 0.85
translucentMethod · 0.80
drawStringCentredRawMethod · 0.80
AdvancedColourClass · 0.50
getFunction · 0.50
drawMethod · 0.45
drawImageMethod · 0.45

Tested by

no test coverage detected