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

Function draw

src/OpenLoco/src/Ui/Windows/ToolbarTopCommon.cpp:49–92  ·  view source on GitHub ↗

0x00439DE4

Source from the content-addressed store, hash-verified

47
48 // 0x00439DE4
49 void draw(Window& self, Gfx::DrawingContext& drawingCtx)
50 {
51 // Draw widgets.
52 self.draw(drawingCtx);
53
54 const auto companyColour = CompanyManager::getPlayerCompanyColour();
55
56 auto lastRoadOption = getGameState().lastRoadOption;
57
58 if (!self.widgets[Widx::road_menu].hidden && lastRoadOption != 0xFF)
59 {
60 uint32_t x = self.widgets[Widx::road_menu].left + self.x;
61 uint32_t y = self.widgets[Widx::road_menu].top + self.y;
62 uint32_t fgImage = 0;
63
64 // Figure out what icon to show on the button face.
65 bool isRoad = lastRoadOption & (1 << 7);
66 if (isRoad)
67 {
68 auto obj = ObjectManager::get<RoadObject>(lastRoadOption & ~(1 << 7));
69 fgImage = Gfx::recolour(obj->image, companyColour);
70 }
71 else
72 {
73 auto obj = ObjectManager::get<TrackObject>(lastRoadOption);
74 fgImage = Gfx::recolour(obj->image + TrackObj::ImageIds::kUiPreviewImage0, companyColour);
75 }
76
77 y--;
78 auto interface = ObjectManager::get<InterfaceSkinObject>();
79 uint32_t bgImage = Gfx::recolour(interface->img + InterfaceSkin::ImageIds::toolbar_empty_transparent, self.getColour(WindowColour::tertiary).c());
80
81 if (Input::isDropdownActive(Ui::WindowType::topToolbar, self.number, Widx::road_menu))
82 {
83 y++;
84 bgImage++;
85 }
86
87 drawingCtx.drawImage(x, y, fgImage);
88
89 y = self.widgets[Widx::road_menu].top + self.y;
90 drawingCtx.drawImage(x, y, bgImage);
91 }
92 }
93
94 // 0x0043A78E
95 void zoomMenuMouseDown(Window* window, WidgetIndex_t widgetIndex)

Callers

nothing calls this directly

Calls 7

getPlayerCompanyColourFunction · 0.85
recolourFunction · 0.85
isDropdownActiveFunction · 0.85
cMethod · 0.80
getColourMethod · 0.80
drawMethod · 0.45
drawImageMethod · 0.45

Tested by

no test coverage detected