MCPcopy Create free account
hub / github.com/VCVRack/Rack / step

Method step

src/window/Window.cpp:424–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422
423
424void Window::step() {
425 double frameTime = system::getTime();
426 if (std::isfinite(internal->frameTime)) {
427 internal->lastFrameDuration = frameTime - internal->frameTime;
428 }
429 internal->frameTime = frameTime;
430 internal->fbCount = 0;
431 // double t1 = 0.0, t2 = 0.0, t3 = 0.0, t4 = 0.0, t5 = 0.0;
432
433 // Make event handlers and step() have a clean NanoVG context
434 nvgReset(vg);
435
436 bndSetFont(uiFont->handle);
437
438 // Poll events
439 // Save and restore context because event handler set their own context based on which window they originate from.
440 Context* context = contextGet();
441 glfwPollEvents();
442 contextSet(context);
443
444 // In case glfwPollEvents() sets another OpenGL context
445 glfwMakeContextCurrent(win);
446
447 // Call cursorPosCallback every frame, not just when the mouse moves
448 {
449 double xpos, ypos;
450 glfwGetCursorPos(win, &xpos, &ypos);
451 cursorPosCallback(win, xpos, ypos);
452 }
453 gamepad::step();
454
455 // Set window title
456 std::string windowTitle = APP_NAME + " " + APP_EDITION_NAME + " " + APP_VERSION;
457 if (APP->patch->path != "") {
458 windowTitle += " - ";
459 if (!APP->history->isSaved())
460 windowTitle += "*";
461 windowTitle += system::getFilename(APP->patch->path);
462 }
463 if (windowTitle != internal->lastWindowTitle) {
464 glfwSetWindowTitle(win, windowTitle.c_str());
465 internal->lastWindowTitle = windowTitle;
466 }
467
468 // Get desired pixel ratio
469 float newPixelRatio;
470 if (settings::pixelRatio > 0.0) {
471 newPixelRatio = settings::pixelRatio;
472 }
473 else {
474 glfwGetWindowContentScale(win, &newPixelRatio, NULL);
475 newPixelRatio = std::floor(newPixelRatio + 0.5);
476 }
477 if (newPixelRatio != pixelRatio) {
478 pixelRatio = newPixelRatio;
479 APP->event->handleDirty();
480 }
481

Callers 1

screenshotModulesMethod · 0.45

Calls 14

getTimeFunction · 0.85
contextGetFunction · 0.85
contextSetFunction · 0.85
cursorPosCallbackFunction · 0.85
stepFunction · 0.85
getFilenameFunction · 0.85
floorFunction · 0.85
VecClass · 0.85
sleepFunction · 0.85
isSavedMethod · 0.80
handleDirtyMethod · 0.80
divMethod · 0.80

Tested by

no test coverage detected