MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / NewFrame

Method NewFrame

plugins/Cardinal/src/DearImGui/imgui.cpp:3987–4196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3985}
3986
3987void ImGui::NewFrame()
3988{
3989 IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
3990 ImGuiContext& g = *GImGui;
3991
3992 // Remove pending delete hooks before frame start.
3993 // This deferred removal avoid issues of removal while iterating the hook vector
3994 for (int n = g.Hooks.Size - 1; n >= 0; n--)
3995 if (g.Hooks[n].Type == ImGuiContextHookType_PendingRemoval_)
3996 g.Hooks.erase(&g.Hooks[n]);
3997
3998 CallContextHooks(&g, ImGuiContextHookType_NewFramePre);
3999
4000 // Check and assert for various common IO and Configuration mistakes
4001 ErrorCheckNewFrameSanityChecks();
4002
4003 // Load settings on first frame, save settings when modified (after a delay)
4004 UpdateSettings();
4005
4006 g.Time += g.IO.DeltaTime;
4007 g.WithinFrameScope = true;
4008 g.FrameCount += 1;
4009 g.TooltipOverrideCount = 0;
4010 g.WindowsActiveCount = 0;
4011 g.MenusIdSubmittedThisFrame.resize(0);
4012
4013 // Calculate frame-rate for the user, as a purely luxurious feature
4014 g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx];
4015 g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime;
4016 g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);
4017 g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame));
4018 g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;
4019
4020 UpdateViewportsNewFrame();
4021
4022 // Setup current font and draw list shared data
4023 g.IO.Fonts->Locked = true;
4024 SetCurrentFont(GetDefaultFont());
4025 IM_ASSERT(g.Font->IsLoaded());
4026 ImRect virtual_space(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
4027 for (int n = 0; n < g.Viewports.Size; n++)
4028 virtual_space.Add(g.Viewports[n]->GetMainRect());
4029 g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4();
4030 g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;
4031 g.DrawListSharedData.SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError);
4032 g.DrawListSharedData.InitialFlags = ImDrawListFlags_None;
4033 if (g.Style.AntiAliasedLines)
4034 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines;
4035 if (g.Style.AntiAliasedLinesUseTex && !(g.Font->ContainerAtlas->Flags & ImFontAtlasFlags_NoBakedLines))
4036 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLinesUseTex;
4037 if (g.Style.AntiAliasedFill)
4038 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedFill;
4039 if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset)
4040 g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset;
4041
4042 // Mark rendering data as invalid to prevent user who may have a handle on it to use it.
4043 for (int n = 0; n < g.Viewports.Size; n++)
4044 {

Callers

nothing calls this directly

Calls 12

ImMinFunction · 0.85
GetDefaultFontFunction · 0.85
ImMaxFunction · 0.85
ImVec2Function · 0.85
eraseMethod · 0.80
IsLoadedMethod · 0.80
GetMainRectMethod · 0.80
ClearInputKeysMethod · 0.80
push_backMethod · 0.80
resizeMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected