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

Function DrawHelp

Source/help.cpp:190–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void DrawHelp(const Surface &out)
191{
192 DrawSTextHelp();
193 DrawQTextBack(out);
194
195 const int lineHeight = LineHeight();
196 const int blankLineHeight = BlankLineHeight();
197
198 string_view title;
199 if (gbIsHellfire)
200 title = gbIsSpawn ? _("Shareware Hellfire Help") : _("Hellfire Help");
201 else
202 title = gbIsSpawn ? _("Shareware Diablo Help") : _("Diablo Help");
203
204 const Point uiPosition = GetUIRectangle().position;
205 const int sx = uiPosition.x + PaddingLeft;
206 const int sy = uiPosition.y;
207
208 DrawString(out, title,
209 { { sx, sy + PaddingTop + blankLineHeight }, { ContentTextWidth, lineHeight } },
210 { UiFlags::ColorWhitegold | UiFlags::AlignCenter });
211
212 const int titleBottom = sy + HeaderHeight();
213 DrawSLine(out, titleBottom);
214
215 const int numLines = NumVisibleLines();
216 const int contentY = titleBottom + DividerLineMarginY() + ContentPaddingY();
217 for (int i = 0; i < numLines; i++) {
218 const string_view line = HelpTextLines[i + SkipLines];
219 if (line.empty()) {
220 continue;
221 }
222
223 int offset = 0;
224 UiFlags style = UiFlags::ColorWhite;
225 if (line[0] == '$') {
226 offset = 1;
227 style = UiFlags::ColorBlue;
228 }
229
230 DrawString(out, line.substr(offset), { { sx, contentY + i * lineHeight }, { ContentTextWidth, lineHeight } }, { style, /*spacing=*/1, lineHeight });
231 }
232
233 DrawString(out, _("Press ESC to end or the arrow keys to scroll."),
234 { { sx, contentY + ContentsTextHeight() + ContentPaddingY() + blankLineHeight }, { ContentTextWidth, lineHeight } },
235 { UiFlags::ColorWhitegold | UiFlags::AlignCenter });
236
237 DrawHelpSlider(out);
238}
239
240void DisplayHelp()
241{

Callers 1

DrawViewFunction · 0.85

Calls 13

DrawSTextHelpFunction · 0.85
DrawQTextBackFunction · 0.85
DrawSLineFunction · 0.85
DrawHelpSliderFunction · 0.85
LineHeightFunction · 0.70
BlankLineHeightFunction · 0.70
HeaderHeightFunction · 0.70
NumVisibleLinesFunction · 0.70
DividerLineMarginYFunction · 0.70
ContentPaddingYFunction · 0.70
ContentsTextHeightFunction · 0.70
DrawStringFunction · 0.50

Tested by

no test coverage detected