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

Function UiProgressDialog

Source/DiabloUI/progress.cpp:93–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91} // namespace
92
93bool UiProgressDialog(int (*fnfunc)())
94{
95 SetFadeLevel(256);
96
97 // Blit the background once and then free it.
98 ProgressLoadBackground();
99
100 ProgressRenderBackground();
101
102 if (RenderDirectlyToOutputSurface && PalSurface != nullptr) {
103 // Render into all the backbuffers if there are multiple.
104 const void *initialPixels = PalSurface->pixels;
105 UiFadeIn();
106 while (PalSurface->pixels != initialPixels) {
107 ProgressRenderBackground();
108 UiFadeIn();
109 }
110 }
111
112 ProgressFreeBackground();
113
114 ProgressLoadForeground();
115
116 endMenu = false;
117 int progress = 0;
118
119 SDL_Event event;
120 while (!endMenu && progress < 100) {
121 progress = fnfunc();
122 ProgressRenderForeground(progress);
123 UiRenderItems(vecProgress);
124 DrawMouse();
125 UiFadeIn();
126
127 while (PollEvent(&event) != 0) {
128 switch (event.type) {
129 case SDL_MOUSEBUTTONDOWN:
130 case SDL_MOUSEBUTTONUP:
131 UiItemMouseEvents(&event, vecProgress);
132 break;
133#ifndef USE_SDL1
134 case SDLK_KP_ENTER:
135#endif
136 case SDLK_ESCAPE:
137 case SDLK_RETURN:
138 case SDLK_SPACE:
139 endMenu = true;
140 break;
141 default:
142 for (MenuAction menuAction : GetMenuActions(event)) {
143 if (IsNoneOf(menuAction, MenuAction_BACK, MenuAction_SELECT))
144 continue;
145 endMenu = true;
146 break;
147 }
148 break;
149 }
150 UiHandleEvents(&event);

Callers 1

msg_wait_resyncFunction · 0.85

Calls 15

SetFadeLevelFunction · 0.85
ProgressLoadBackgroundFunction · 0.85
ProgressRenderBackgroundFunction · 0.85
UiFadeInFunction · 0.85
ProgressFreeBackgroundFunction · 0.85
ProgressLoadForegroundFunction · 0.85
ProgressRenderForegroundFunction · 0.85
UiRenderItemsFunction · 0.85
DrawMouseFunction · 0.85
PollEventFunction · 0.85
UiItemMouseEventsFunction · 0.85
GetMenuActionsFunction · 0.85

Tested by

no test coverage detected