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

Function drawGraphKeyOverall

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

0x0046D273

Source from the content-addressed store, hash-verified

1322
1323 // 0x0046D273
1324 static void drawGraphKeyOverall(Window* self, Gfx::DrawingContext& drawingCtx, uint16_t x, uint16_t& y)
1325 {
1326 static constexpr PaletteIndex_t overallColours[] = {
1327 PaletteIndex::mutedDarkRed7,
1328 PaletteIndex::mutedPurple7,
1329 PaletteIndex::black2,
1330 PaletteIndex::black7,
1331 PaletteIndex::orange8,
1332 PaletteIndex::green6,
1333 };
1334
1335 static constexpr StringId lineNames[] = {
1336 StringIds::map_key_towns,
1337 StringIds::map_key_industries,
1338 StringIds::map_key_roads,
1339 StringIds::map_key_railways,
1340 StringIds::map_key_stations,
1341 StringIds::map_key_vegetation,
1342 };
1343
1344 auto tr = Gfx::TextRenderer(drawingCtx);
1345
1346 for (auto i = 0; i < kOverallGraphKeySize; i++)
1347 {
1348 auto colour = overallColours[i];
1349 if (!(self->var_854 & (1 << i)) || !(mapFrameNumber & (1 << 2)))
1350 {
1351 drawingCtx.drawRect(x, y + 3, 5, 5, colour, Gfx::RectFlags::none);
1352 }
1353
1354 FormatArguments args{};
1355 args.push(lineNames[i]);
1356
1357 auto stringId = StringIds::small_black_string;
1358
1359 if (self->var_854 & (1 << i))
1360 {
1361 stringId = StringIds::small_white_string;
1362 }
1363
1364 auto point = Point(x + 6, y);
1365 tr.drawStringLeftClipped(point, 94, Colour::black, stringId, args);
1366
1367 y += 10;
1368 }
1369 }
1370
1371 // 0x004FDD62
1372 static constexpr PaletteIndex_t vehicleTypeColours[] = {

Callers 1

drawFunction · 0.85

Calls 4

TextRendererClass · 0.85
drawStringLeftClippedMethod · 0.80
drawRectMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected