MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / NewFrame

Method NewFrame

extern/imgui/imgui.cpp:4754–5016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4752}
4753
4754void ImGui::NewFrame()
4755{
4756 IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
4757 ImGuiContext& g = *GImGui;
4758
4759 // Remove pending delete hooks before frame start.
4760 // This deferred removal avoid issues of removal while iterating the hook vector
4761 for (int n = g.Hooks.Size - 1; n >= 0; n--)
4762 if (g.Hooks[n].Type == ImGuiContextHookType_PendingRemoval_)
4763 g.Hooks.erase(&g.Hooks[n]);
4764
4765 CallContextHooks(&g, ImGuiContextHookType_NewFramePre);
4766
4767 // Check and assert for various common IO and Configuration mistakes
4768 g.ConfigFlagsLastFrame = g.ConfigFlagsCurrFrame;
4769 ErrorCheckNewFrameSanityChecks();
4770 g.ConfigFlagsCurrFrame = g.IO.ConfigFlags;
4771
4772 // Load settings on first frame, save settings when modified (after a delay)
4773 UpdateSettings();
4774
4775 g.Time += g.IO.DeltaTime;
4776 g.WithinFrameScope = true;
4777 g.FrameCount += 1;
4778 g.TooltipOverrideCount = 0;
4779 g.WindowsActiveCount = 0;
4780 g.MenusIdSubmittedThisFrame.resize(0);
4781
4782 // Calculate frame-rate for the user, as a purely luxurious feature
4783 g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx];
4784 g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime;
4785 g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);
4786 g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame));
4787 g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;
4788
4789 // Process input queue (trickle as many events as possible), turn events into writes to IO structure
4790 g.InputEventsTrail.resize(0);
4791 UpdateInputEvents(g.IO.ConfigInputTrickleEventQueue);
4792
4793 // Update viewports (after processing input queue, so io.MouseHoveredViewport is set)
4794 UpdateViewportsNewFrame();
4795
4796 // Setup current font and draw list shared data
4797 // FIXME-VIEWPORT: the concept of a single ClipRectFullscreen is not ideal!
4798 g.IO.Fonts->Locked = true;
4799 SetCurrentFont(GetDefaultFont());
4800 IM_ASSERT(g.Font->IsLoaded());
4801 ImRect virtual_space(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
4802 for (int n = 0; n < g.Viewports.Size; n++)
4803 virtual_space.Add(g.Viewports[n]->GetMainRect());
4804 g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4();
4805 g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;
4806 g.DrawListSharedData.SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError);
4807 g.DrawListSharedData.InitialFlags = ImDrawListFlags_None;
4808 if (g.Style.AntiAliasedLines)
4809 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines;
4810 if (g.Style.AntiAliasedLinesUseTex && !(g.Font->ContainerAtlas->Flags & ImFontAtlasFlags_NoBakedLines))
4811 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLinesUseTex;

Callers

nothing calls this directly

Calls 13

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

Tested by

no test coverage detected