MCPcopy Create free account
hub / github.com/TurningWheel/Barony / updateLoadingScreen

Function updateLoadingScreen

src/ui/LoadingScreen.cpp:232–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232void updateLoadingScreen(real_t progress) {
233 std::lock_guard<std::mutex> lock(loading_mutex);
234 auto loading_frame = gui->findFrame("loading_frame");
235 if (!loading_frame)
236 {
237 return;
238 }
239
240#if 0
241 // update red progress bar (deprecated)
242 auto progress_filled = loading_frame->findImage("progress_filled");
243 if (progress_filled)
244 {
245 progress_filled->pos = SDL_Rect{0,
246 Frame::virtualScreenY - 64,
247 (int)((Frame::virtualScreenX * progress) / (real_t)100),
248 64};
249 }
250
251 // update percentage text (deprecated)
252 auto text = loading_frame->findField("text");
253 if (text) {
254 char buf[8];
255 snprintf(buf, sizeof(buf), "%d%%", (int)progress);
256 text->setText(buf);
257 }
258#endif
259
260 // update loading bar
261 auto loading_bar = loading_frame->findFrame("loading_bar");
262 if (loading_bar) {
263 const int size = ((int)progress * 1062) / 100;
264
265 // gas
266 auto gas = loading_bar->findImage("gas");
267 if (gas) {
268 gas->pos.w = size;
269 }
270
271 // bubbles
272 auto bubbles = loading_bar->findImage("bubbles");
273 if (bubbles) {
274 bubbles->pos.w = size;
275 }
276
277 // gungnir
278 auto gungnir = loading_bar->findImage("gungnir");
279 if (gungnir) {
280 gungnir->pos.x = size - 16;
281 }
282 }
283}
284
285void destroyLoadingScreen() {
286 std::lock_guard<std::mutex> lock(loading_mutex);

Callers 10

unloadModsMethod · 0.85
loadModsMethod · 0.85
generatePolyModelsFunction · 0.85
generateVBOsFunction · 0.85
physfsReloadSoundsFunction · 0.85
gameLogicFunction · 0.85
initAppFunction · 0.85
initGameFunction · 0.85
changeLevelFunction · 0.85
loadSoundResourcesFunction · 0.85

Calls 4

findFrameMethod · 0.80
findImageMethod · 0.80
findFieldMethod · 0.80
setTextMethod · 0.45

Tested by

no test coverage detected