MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / NewFrame

Method NewFrame

Dependencies/ImGui/src/imgui.cpp:5675–5970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5673}
5674
5675void ImGui::NewFrame()
5676{
5677 IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
5678 ImGuiContext& g = *GImGui;
5679
5680 // Remove pending delete hooks before frame start.
5681 // This deferred removal avoid issues of removal while iterating the hook vector
5682 for (int n = g.Hooks.Size - 1; n >= 0; n--)
5683 if (g.Hooks[n].Type == ImGuiContextHookType_PendingRemoval_)
5684 g.Hooks.erase(&g.Hooks[n]);
5685
5686 CallContextHooks(&g, ImGuiContextHookType_NewFramePre);
5687
5688 // Check and assert for various common IO and Configuration mistakes
5689 g.ConfigFlagsLastFrame = g.ConfigFlagsCurrFrame;
5690 ErrorCheckNewFrameSanityChecks();
5691 g.ConfigFlagsCurrFrame = g.IO.ConfigFlags;
5692
5693 // Load settings on first frame, save settings when modified (after a delay)
5694 UpdateSettings();
5695
5696 g.Time += g.IO.DeltaTime;
5697 g.FrameCount += 1;
5698 g.TooltipOverrideCount = 0;
5699 g.WindowsActiveCount = 0;
5700 g.MenusIdSubmittedThisFrame.resize(0);
5701
5702 // Calculate frame-rate for the user, as a purely luxurious feature
5703 g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx];
5704 g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime;
5705 g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_COUNTOF(g.FramerateSecPerFrame);
5706 g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_COUNTOF(g.FramerateSecPerFrame));
5707 g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;
5708
5709 // Process input queue (trickle as many events as possible), turn events into writes to IO structure
5710 g.InputEventsTrail.resize(0);
5711 UpdateInputEvents(g.IO.ConfigInputTrickleEventQueue);
5712
5713 // Update viewports (after processing input queue, so io.MouseHoveredViewport is set)
5714 UpdateViewportsNewFrame();
5715
5716 // Update texture list (collect destroyed textures, etc.)
5717 UpdateTexturesNewFrame();
5718
5719 // Setup current font and draw list shared data
5720 SetupDrawListSharedData();
5721 UpdateFontsNewFrame();
5722
5723 g.WithinFrameScope = true;
5724
5725 // Mark rendering data as invalid to prevent user who may have a handle on it to use it.
5726 for (ImGuiViewportP* viewport : g.Viewports)
5727 {
5728 viewport->DrawData = NULL;
5729 viewport->DrawDataP.Valid = false;
5730 }
5731
5732 // Drag and drop keep the source ID alive so even if the source disappear our state is consistent

Callers

nothing calls this directly

Calls 9

ImMinFunction · 0.85
SetupDrawListSharedDataFunction · 0.85
ImMaxFunction · 0.85
ImHashStrFunction · 0.85
ImVec2Function · 0.85
GetByIndexMethod · 0.80
eraseMethod · 0.45
resizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected