| 3584 | } |
| 3585 | |
| 3586 | void ImGui::NewFrame() |
| 3587 | { |
| 3588 | IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?"); |
| 3589 | ImGuiContext& g = *GImGui; |
| 3590 | |
| 3591 | #ifdef IMGUI_ENABLE_TEST_ENGINE |
| 3592 | ImGuiTestEngineHook_PreNewFrame(&g); |
| 3593 | #endif |
| 3594 | |
| 3595 | // Check and assert for various common IO and Configuration mistakes |
| 3596 | NewFrameSanityChecks(); |
| 3597 | |
| 3598 | // Load settings on first frame (if not explicitly loaded manually before) |
| 3599 | if (!g.SettingsLoaded) |
| 3600 | { |
| 3601 | IM_ASSERT(g.SettingsWindows.empty()); |
| 3602 | if (g.IO.IniFilename) |
| 3603 | LoadIniSettingsFromDisk(g.IO.IniFilename); |
| 3604 | g.SettingsLoaded = true; |
| 3605 | } |
| 3606 | |
| 3607 | // Save settings (with a delay after the last modification, so we don't spam disk too much) |
| 3608 | if (g.SettingsDirtyTimer > 0.0f) |
| 3609 | { |
| 3610 | g.SettingsDirtyTimer -= g.IO.DeltaTime; |
| 3611 | if (g.SettingsDirtyTimer <= 0.0f) |
| 3612 | { |
| 3613 | if (g.IO.IniFilename != NULL) |
| 3614 | SaveIniSettingsToDisk(g.IO.IniFilename); |
| 3615 | else |
| 3616 | g.IO.WantSaveIniSettings = true; // Let user know they can call SaveIniSettingsToMemory(). user will need to clear io.WantSaveIniSettings themselves. |
| 3617 | g.SettingsDirtyTimer = 0.0f; |
| 3618 | } |
| 3619 | } |
| 3620 | |
| 3621 | g.Time += g.IO.DeltaTime; |
| 3622 | g.WithinFrameScope = true; |
| 3623 | g.FrameCount += 1; |
| 3624 | g.TooltipOverrideCount = 0; |
| 3625 | g.WindowsActiveCount = 0; |
| 3626 | |
| 3627 | // Setup current font and draw list shared data |
| 3628 | g.IO.Fonts->Locked = true; |
| 3629 | SetCurrentFont(GetDefaultFont()); |
| 3630 | IM_ASSERT(g.Font->IsLoaded()); |
| 3631 | g.DrawListSharedData.ClipRectFullscreen = ImVec4(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y); |
| 3632 | g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol; |
| 3633 | g.DrawListSharedData.SetCircleSegmentMaxError(g.Style.CircleSegmentMaxError); |
| 3634 | g.DrawListSharedData.InitialFlags = ImDrawListFlags_None; |
| 3635 | if (g.Style.AntiAliasedLines) |
| 3636 | g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines; |
| 3637 | if (g.Style.AntiAliasedFill) |
| 3638 | g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedFill; |
| 3639 | if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset) |
| 3640 | g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset; |
| 3641 | |
| 3642 | g.BackgroundDrawList.Clear(); |
| 3643 | g.BackgroundDrawList.PushTextureID(g.IO.Fonts->TexID); |
nothing calls this directly
no test coverage detected