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

Function setVideoFormat

src/bzflag/guiplaying.cpp:446–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444
445
446bool setVideoFormat(int index, bool test) {
447#if defined(_WIN32)
448 // give windows extra time to test format (context reloading takes a while)
449 static const float testDuration = 10.0f;
450#else
451 static const float testDuration = 5.0f;
452#endif
453
454 // ignore bad formats or when the format test timer is running
455 if (testVideoFormatTimer != 0.0f || !display->isValidResolution(index)) {
456 return false;
457 }
458
459 // ignore if no change
460 if (display->getResolution() == index) { return true; }
461
462 // change it
463 testVideoPrevFormat = display->getResolution();
464 if (!display->setResolution(index)) { return false; }
465
466 // handle resize
467 mainWindow->setFullscreen();
468 mainWindow->getWindow()->callResizeCallbacks();
469 mainWindow->warpMouse();
470 if (test) { testVideoFormatTimer = testDuration; }
471 else if (shouldGrabMouse()) { mainWindow->grabMouse(); }
472 return true;
473}
474
475
476

Callers 2

updateVideoFormatTimerFunction · 0.70
setFormatMethod · 0.70

Calls 9

isValidResolutionMethod · 0.80
getResolutionMethod · 0.80
setResolutionMethod · 0.80
callResizeCallbacksMethod · 0.80
getWindowMethod · 0.80
shouldGrabMouseFunction · 0.70
setFullscreenMethod · 0.45
warpMouseMethod · 0.45
grabMouseMethod · 0.45

Tested by

no test coverage detected