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

Method drawPreviewImage

src/OpenLoco/src/Objects/CurrencyObject.cpp:65–84  ·  view source on GitHub ↗

0x0046DFC3

Source from the content-addressed store, hash-verified

63
64 // 0x0046DFC3
65 void CurrencyObject::drawPreviewImage(Gfx::DrawingContext& drawingCtx, const int16_t x, const int16_t y) const
66 {
67 auto tr = Gfx::TextRenderer(drawingCtx);
68
69 auto currencyIndex = objectIcon + 3;
70
71 auto defaultElement = Gfx::getG1Element(ImageIds::currency_symbol);
72 auto backupElement = *defaultElement;
73 auto currencyElement = Gfx::getG1Element(currencyIndex);
74
75 *defaultElement = *currencyElement;
76
77 auto defaultWidth = Gfx::getCharacterWidth(Gfx::Font::large, U'£');
78 Gfx::setCharacterWidth(Gfx::Font::large, U'£', currencyElement->width + 1);
79
80 tr.drawStringCentred(Ui::Point(x, y - 9), Colour::black, StringIds::object_currency_big_font);
81
82 Gfx::setCharacterWidth(Gfx::Font::large, U'£', defaultWidth);
83 *defaultElement = backupElement;
84 }
85}

Callers

nothing calls this directly

Calls 5

TextRendererClass · 0.85
getG1ElementFunction · 0.85
getCharacterWidthFunction · 0.85
setCharacterWidthFunction · 0.85
drawStringCentredMethod · 0.80

Tested by

no test coverage detected