MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / HelpDisplay

Function HelpDisplay

Descent3/help.cpp:202–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200#define WND_HELP_Y (Game_window_h - WND_HELP_H) / 2
201
202void HelpDisplay(void) {
203 newuiTiledWindow help_wnd;
204 newuiSheet *sheet;
205 int strs_to_print = 0;
206 int index, res;
207 bool exit_menu = false;
208
209 help_wnd.Create(TITLETEXT, 0, 0, WND_HELP_W, WND_HELP_H);
210 sheet = help_wnd.GetSheet();
211
212 // add commands
213 help_wnd.AddAcceleratorKey(KEY_F1, UID_CANCEL);
214
215 strs_to_print = 0;
216
217 // find out how many strings to print out
218 while (HelpText[strs_to_print] > 0)
219 strs_to_print++;
220
221 sheet->NewGroup(NULL, 30, 10);
222 for (index = 0; index < strs_to_print; index += 2) {
223 if (index < strs_to_print) {
224 sheet->AddText(TXT(HelpText[index]));
225 }
226 }
227
228 sheet->NewGroup(NULL, 130, 10);
229 for (index = 1; index < strs_to_print; index += 2) {
230 if (index < strs_to_print) {
231 sheet->AddText(TXT(HelpText[index]));
232 }
233 }
234
235 sheet->NewGroup(NULL, WND_HELP_W - 160, WND_HELP_H - 96, NEWUI_ALIGN_HORIZ);
236 sheet->AddButton(TXT_OK, UID_CANCEL);
237
238 // quit_hot.Create(&help_wnd, UID_CANCEL, 0, &UITextItem(TXT_PRESSESCRET, UICOL_HOTSPOT_LO,UIALPHA_HOTSPOT_LO),
239 // &UITextItem(TXT_PRESSESCRET,UICOL_HOTSPOT_HI,UIALPHA_HOTSPOT_HI),
240 // HELP_X_KEY_POS, WND_HELP_H - OKCANCEL_YOFFSET,
241 // 0,0,UIF_FIT|UIF_CENTER);
242 help_wnd.Open();
243
244 while (!exit_menu) {
245 res = help_wnd.DoUI();
246
247 // handle all UI results.
248 switch (res) {
249 case UID_CANCEL:
250 case NEWUIRES_FORCEQUIT:
251 exit_menu = true;
252 break;
253 }
254 }
255
256 help_wnd.Close();
257 help_wnd.Destroy();
258}

Callers 1

RunGameMenuFunction · 0.85

Calls 10

GetSheetMethod · 0.80
AddAcceleratorKeyMethod · 0.80
NewGroupMethod · 0.80
AddTextMethod · 0.80
AddButtonMethod · 0.80
CreateMethod · 0.45
OpenMethod · 0.45
DoUIMethod · 0.45
CloseMethod · 0.45
DestroyMethod · 0.45

Tested by

no test coverage detected