MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / NewFrame

Method NewFrame

Source/3rdParty/imgui/imgui.cpp:5498–5781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5496}
5497
5498void ImGui::NewFrame()
5499{
5500 IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
5501 ImGuiContext& g = *GImGui;
5502
5503 // Remove pending delete hooks before frame start.
5504 // This deferred removal avoid issues of removal while iterating the hook vector
5505 for (int n = g.Hooks.Size - 1; n >= 0; n--)
5506 if (g.Hooks[n].Type == ImGuiContextHookType_PendingRemoval_)
5507 g.Hooks.erase(&g.Hooks[n]);
5508
5509 CallContextHooks(&g, ImGuiContextHookType_NewFramePre);
5510
5511 // Check and assert for various common IO and Configuration mistakes
5512 ErrorCheckNewFrameSanityChecks();
5513
5514 // Load settings on first frame, save settings when modified (after a delay)
5515 UpdateSettings();
5516
5517 g.Time += g.IO.DeltaTime;
5518 g.FrameCount += 1;
5519 g.TooltipOverrideCount = 0;
5520 g.WindowsActiveCount = 0;
5521 g.MenusIdSubmittedThisFrame.resize(0);
5522
5523 // Calculate frame-rate for the user, as a purely luxurious feature
5524 g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx];
5525 g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime;
5526 g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_COUNTOF(g.FramerateSecPerFrame);
5527 g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_COUNTOF(g.FramerateSecPerFrame));
5528 g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;
5529
5530 // Process input queue (trickle as many events as possible), turn events into writes to IO structure
5531 g.InputEventsTrail.resize(0);
5532 UpdateInputEvents(g.IO.ConfigInputTrickleEventQueue);
5533
5534 // Update viewports (after processing input queue, so io.MouseHoveredViewport is set)
5535 UpdateViewportsNewFrame();
5536
5537 // Update texture list (collect destroyed textures, etc.)
5538 UpdateTexturesNewFrame();
5539
5540 // Setup current font and draw list shared data
5541 SetupDrawListSharedData();
5542 UpdateFontsNewFrame();
5543
5544 g.WithinFrameScope = true;
5545
5546 // Mark rendering data as invalid to prevent user who may have a handle on it to use it.
5547 for (ImGuiViewportP* viewport : g.Viewports)
5548 viewport->DrawDataP.Valid = false;
5549
5550 // Drag and drop keep the source ID alive so even if the source disappear our state is consistent
5551 if (g.DragDropActive && g.DragDropPayload.SourceId == g.ActiveId)
5552 KeepAliveID(g.DragDropPayload.SourceId);
5553
5554 // [DEBUG]
5555 if (!g.IO.ConfigDebugHighlightIdConflicts || !g.IO.KeyCtrl) // Count is locked while holding Ctrl

Callers

nothing calls this directly

Calls 13

ImMinFunction · 0.85
SetupDrawListSharedDataFunction · 0.85
ImMaxFunction · 0.85
ImHashStrFunction · 0.85
ShortcutClass · 0.85
SetNextWindowSizeFunction · 0.85
ImVec2Function · 0.85
GetByIndexMethod · 0.80
BeginFunction · 0.50
eraseMethod · 0.45
resizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected