MCPcopy Create free account
hub / github.com/RenderKit/embree / NewFrame

Method NewFrame

tutorials/common/imgui/imgui.cpp:4525–4775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4523}
4524
4525void ImGui::NewFrame()
4526{
4527 IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
4528 ImGuiContext& g = *GImGui;
4529
4530 // Remove pending delete hooks before frame start.
4531 // This deferred removal avoid issues of removal while iterating the hook vector
4532 for (int n = g.Hooks.Size - 1; n >= 0; n--)
4533 if (g.Hooks[n].Type == ImGuiContextHookType_PendingRemoval_)
4534 g.Hooks.erase(&g.Hooks[n]);
4535
4536 CallContextHooks(&g, ImGuiContextHookType_NewFramePre);
4537
4538 // Check and assert for various common IO and Configuration mistakes
4539 ErrorCheckNewFrameSanityChecks();
4540
4541 // Load settings on first frame, save settings when modified (after a delay)
4542 UpdateSettings();
4543
4544 g.Time += g.IO.DeltaTime;
4545 g.WithinFrameScope = true;
4546 g.FrameCount += 1;
4547 g.TooltipOverrideCount = 0;
4548 g.WindowsActiveCount = 0;
4549 g.MenusIdSubmittedThisFrame.resize(0);
4550
4551 // Calculate frame-rate for the user, as a purely luxurious feature
4552 g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx];
4553 g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime;
4554 g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);
4555 g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame));
4556 g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;
4557
4558 UpdateViewportsNewFrame();
4559
4560 // Setup current font and draw list shared data
4561 g.IO.Fonts->Locked = true;
4562 SetCurrentFont(GetDefaultFont());
4563 IM_ASSERT(g.Font->IsLoaded());
4564 ImRect virtual_space(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
4565 for (int n = 0; n < g.Viewports.Size; n++)
4566 virtual_space.Add(g.Viewports[n]->GetMainRect());
4567 g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4();
4568 g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;
4569 g.DrawListSharedData.SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError);
4570 g.DrawListSharedData.InitialFlags = ImDrawListFlags_None;
4571 if (g.Style.AntiAliasedLines)
4572 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines;
4573 if (g.Style.AntiAliasedLinesUseTex && !(g.Font->ContainerAtlas->Flags & ImFontAtlasFlags_NoBakedLines))
4574 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLinesUseTex;
4575 if (g.Style.AntiAliasedFill)
4576 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedFill;
4577 if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset)
4578 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset;
4579
4580 // Mark rendering data as invalid to prevent user who may have a handle on it to use it.
4581 for (int n = 0; n < g.Viewports.Size; n++)
4582 {

Callers

nothing calls this directly

Calls 12

ImMinFunction · 0.85
GetDefaultFontFunction · 0.85
ImMaxFunction · 0.85
ImVec2Function · 0.85
IsLoadedMethod · 0.80
AddMethod · 0.80
GetMainRectMethod · 0.80
GetByIndexMethod · 0.80
resizeMethod · 0.45
ClearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected