MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / DrawHelpSlider

Function DrawHelpSlider

Source/help.cpp:142–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void DrawHelpSlider(const Surface &out)
143{
144 const Point uiPosition = GetUIRectangle().position;
145 const int sliderXPos = ContentTextWidth + uiPosition.x + 36;
146 int sliderStart = uiPosition.y + HeaderHeight() + LineHeight() + 3;
147 int sliderEnd = uiPosition.y + PaddingTop + PanelHeight - 12;
148 ClxDraw(out, { sliderXPos, sliderStart }, (*pSTextSlidCels)[11]);
149 sliderStart += 12;
150 int sliderCurrent = sliderStart;
151 for (; sliderCurrent < sliderEnd; sliderCurrent += 12) {
152 ClxDraw(out, { sliderXPos, sliderCurrent }, (*pSTextSlidCels)[13]);
153 }
154 ClxDraw(out, { sliderXPos, sliderCurrent }, (*pSTextSlidCels)[10]);
155 // Subtract visible lines from the total number of lines to get the actual
156 // scroll range
157 const int scrollRange = static_cast<int>(HelpTextLines.size()) - NumVisibleLines();
158 // Subtract the size of the arrow buttons to get the length of the interior
159 // part of the slider
160 const int sliderLength = sliderCurrent - 12 - sliderStart;
161 ClxDraw(out, { sliderXPos, sliderStart + ((static_cast<int>(SkipLines) * sliderLength) / scrollRange) }, (*pSTextSlidCels)[12]);
162}
163
164} // namespace
165

Callers 1

DrawHelpFunction · 0.85

Calls 5

ClxDrawFunction · 0.85
HeaderHeightFunction · 0.70
LineHeightFunction · 0.70
NumVisibleLinesFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected