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

Function drawTownNames

src/OpenLoco/src/Ui/Windows/MapWindow.cpp:2132–2154  ·  view source on GitHub ↗

0x0046C481

Source from the content-addressed store, hash-verified

2130
2131 // 0x0046C481
2132 static void drawTownNames(Gfx::DrawingContext& drawingCtx)
2133 {
2134 auto tr = Gfx::TextRenderer(drawingCtx);
2135
2136 for (const auto& town : TownManager::towns())
2137 {
2138 auto townPos = locationToMapWindowPos({ town.x, town.y });
2139
2140 char townNameBuffer[512]{};
2141 StringManager::formatString(townNameBuffer, town.name);
2142 tr.setCurrentFont(Gfx::Font::small);
2143
2144 auto strWidth = tr.getStringWidth(townNameBuffer);
2145
2146 strWidth /= 2;
2147
2148 townPos.x -= strWidth;
2149 townPos.y -= 3;
2150
2151 tr.setCurrentFont(Gfx::Font::small);
2152 tr.drawString(townPos, AdvancedColour(Colour::purple).outline(), townNameBuffer);
2153 }
2154 }
2155
2156 // 0x0046B806
2157 static void drawScroll(Window& self, Gfx::DrawingContext& drawingCtx, [[maybe_unused]] const uint32_t scrollIndex)

Callers 1

drawScrollFunction · 0.70

Calls 9

TextRendererClass · 0.85
townsFunction · 0.85
locationToMapWindowPosFunction · 0.85
formatStringFunction · 0.85
setCurrentFontMethod · 0.80
getStringWidthMethod · 0.80
drawStringMethod · 0.80
outlineMethod · 0.80
AdvancedColourClass · 0.50

Tested by

no test coverage detected