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

Function drawScroll

src/OpenLoco/src/Ui/Windows/ObjectSelectionWindow.cpp:1148–1229  ·  view source on GitHub ↗

0x0047361D

Source from the content-addressed store, hash-verified

1146
1147 // 0x0047361D
1148 static void drawScroll(Window& self, Gfx::DrawingContext& drawingCtx, const uint32_t)
1149 {
1150 const auto& rt = drawingCtx.currentRenderTarget();
1151
1152 auto tr = Gfx::TextRenderer(drawingCtx);
1153
1154 drawingCtx.clearSingle(Colours::getShade(self.getColour(WindowColour::secondary).c(), 4));
1155
1156 if (ObjectManager::getNumInstalledObjects() == 0)
1157 {
1158 return;
1159 }
1160
1161 const auto& selection = ObjectManager::getCurrentSelectionList();
1162 int y = 0;
1163 for (auto& entry : _tabObjectList)
1164 {
1165 if (entry.display == Visibility::hidden)
1166 {
1167 continue;
1168 }
1169
1170 if (y + kRowHeight < rt.y)
1171 {
1172 y += kRowHeight;
1173 continue;
1174 }
1175 else if (y > rt.y + rt.height)
1176 {
1177 break;
1178 }
1179
1180 Gfx::RectInsetFlags flags = Gfx::RectInsetFlags::colourLight | Gfx::RectInsetFlags::fillDarker | Gfx::RectInsetFlags::borderInset;
1181 drawingCtx.fillRectInset(2, y, 11, y + 10, self.getColour(WindowColour::secondary), flags);
1182
1183 uint8_t textColour = ControlCodes::Colour::black;
1184
1185 auto objectPtr = self.object;
1186 if (objectPtr != nullptr)
1187 {
1188 auto& hoverObject = ObjectManager::getObjectInIndex(self.rowHover)._header;
1189 if (entry.object._header == hoverObject)
1190 {
1191 drawingCtx.fillRect(0, y, self.width, y + kRowHeight - 1, enumValue(ExtColour::unk30), Gfx::RectFlags::transparent);
1192 textColour = ControlCodes::windowColour2;
1193 }
1194 }
1195
1196 using namespace ObjectManager;
1197
1198 if ((selection.objectFlags[entry.index] & SelectedObjectsFlags::selected) != SelectedObjectsFlags::none)
1199 {
1200 auto x = 2;
1201 tr.setCurrentFont(Gfx::Font::m2);
1202
1203 if (textColour != ControlCodes::windowColour2)
1204 {
1205 tr.setCurrentFont(Gfx::Font::m1);

Callers

nothing calls this directly

Calls 13

TextRendererClass · 0.85
getShadeFunction · 0.85
getNumInstalledObjectsFunction · 0.85
enumValueFunction · 0.85
clearSingleMethod · 0.80
cMethod · 0.80
getColourMethod · 0.80
setCurrentFontMethod · 0.80
opaqueMethod · 0.80
insetMethod · 0.80
drawStringMethod · 0.80
fillRectInsetMethod · 0.45

Tested by

no test coverage detected