MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / curlProgressFunc

Function curlProgressFunc

src/bzflag/guiplaying.cpp:1300–1344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1298
1299
1300int curlProgressFunc(void* /*clientp*/,
1301 double dltotal, double dlnow,
1302 double /*ultotal*/, double /*ulnow*/) {
1303 // FIXME: beaucoup cheeze here in the aborting style
1304 // we should be using async dns and multi-curl
1305
1306 // run an inner main loop to check if we should abort
1307 BzfEvent event;
1308 if (display->isEventPending() && display->peekEvent(event)) {
1309 switch (event.type) {
1310 case BzfEvent::Quit:
1311 return 1; // terminate the curl call
1312 case BzfEvent::KeyDown:
1313 display->getEvent(event); // flush the event
1314 if (event.keyDown.unicode == 27) {
1315 return 1; // terminate the curl call
1316 }
1317
1318 break;
1319 case BzfEvent::KeyUp:
1320 display->getEvent(event); // flush the event
1321 break;
1322 case BzfEvent::MouseMove:
1323 display->getEvent(event); // flush the event
1324 break;
1325 case BzfEvent::Unset:
1326 case BzfEvent::Map:
1327 case BzfEvent::Unmap:
1328 case BzfEvent::Redraw:
1329 case BzfEvent::Resize:
1330 // leave the event, it might be important
1331 break;
1332 }
1333 }
1334
1335 // update the status
1336 double percentage = 0.0;
1337 if ((int)dltotal > 0) {
1338 percentage = 100.0 * dlnow / dltotal;
1339 }
1340
1341 showError(TextUtils::format("%2.1f%% (%i/%i)", percentage, (int) dlnow, (int) dltotal).c_str());
1342
1343 return 0;
1344}
1345
1346
1347static void textureDoneFunc(const trResourceItem& item, bool success) {

Callers

nothing calls this directly

Calls 6

c_strMethod · 0.80
showErrorFunction · 0.70
formatFunction · 0.50
isEventPendingMethod · 0.45
peekEventMethod · 0.45
getEventMethod · 0.45

Tested by

no test coverage detected