MCPcopy Create free account
hub / github.com/diasurgical/devilution / DialogLoop

Function DialogLoop

SourceX/DiabloUI/dialogs.cpp:223–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223void DialogLoop(UiItem *items, std::size_t num_items, UiItem *render_behind, std::size_t render_behind_size)
224{
225 SDL_Event event;
226 dialogEnd = false;
227 do {
228 while (SDL_PollEvent(&event)) {
229 switch (event.type) {
230 case SDL_MOUSEBUTTONDOWN:
231 case SDL_MOUSEBUTTONUP:
232 UiItemMouseEvents(&event, items, num_items);
233 break;
234 default:
235 switch (GetMenuAction(event)) {
236 case MenuAction::BACK:
237 case MenuAction::SELECT:
238 dialogEnd = true;
239 break;
240 default:
241 break;
242 }
243 break;
244 }
245 UiHandleEvents(&event);
246 }
247
248 if (render_behind_size == 0) {
249 SDL_FillRect(GetOutputSurface(), nullptr, 0);
250 } else {
251 UiRenderItems(render_behind, render_behind_size);
252 }
253 UiRenderItems(items, num_items);
254 DrawMouse();
255 UiFadeIn();
256 } while (!dialogEnd);
257}
258
259} // namespace
260

Callers 1

UiOkDialogFunction · 0.85

Calls 7

UiItemMouseEventsFunction · 0.85
GetMenuActionFunction · 0.85
UiHandleEventsFunction · 0.85
GetOutputSurfaceFunction · 0.85
UiRenderItemsFunction · 0.85
DrawMouseFunction · 0.85
UiFadeInFunction · 0.85

Tested by

no test coverage detected