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

Method ErrorCheckNewFrameSanityChecks

tutorials/common/imgui/imgui.cpp:8720–8757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8718}
8719
8720static void ImGui::ErrorCheckNewFrameSanityChecks()
8721{
8722 ImGuiContext& g = *GImGui;
8723
8724 // Check user IM_ASSERT macro
8725 // (IF YOU GET A WARNING OR COMPILE ERROR HERE: it means your assert macro is incorrectly defined!
8726 // If your macro uses multiple statements, it NEEDS to be surrounded by a 'do { ... } while (0)' block.
8727 // This is a common C/C++ idiom to allow multiple statements macros to be used in control flow blocks.)
8728 // #define IM_ASSERT(EXPR) if (SomeCode(EXPR)) SomeMoreCode(); // Wrong!
8729 // #define IM_ASSERT(EXPR) do { if (SomeCode(EXPR)) SomeMoreCode(); } while (0) // Correct!
8730 if (true) IM_ASSERT(1); else IM_ASSERT(0);
8731
8732 // Check user data
8733 // (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument)
8734 IM_ASSERT(g.Initialized);
8735 IM_ASSERT((g.IO.DeltaTime > 0.0f || g.FrameCount == 0) && "Need a positive DeltaTime!");
8736 IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
8737 IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value!");
8738 IM_ASSERT(g.IO.Fonts->IsBuilt() && "Font Atlas not built! Make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()");
8739 IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting!");
8740 IM_ASSERT(g.Style.CircleTessellationMaxError > 0.0f && "Invalid style setting!");
8741 IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting!"); // Allows us to avoid a few clamps in color computations
8742 IM_ASSERT(g.Style.WindowMinSize.x >= 1.0f && g.Style.WindowMinSize.y >= 1.0f && "Invalid style setting.");
8743 IM_ASSERT(g.Style.WindowMenuButtonPosition == ImGuiDir_None || g.Style.WindowMenuButtonPosition == ImGuiDir_Left || g.Style.WindowMenuButtonPosition == ImGuiDir_Right);
8744 IM_ASSERT(g.Style.ColorButtonPosition == ImGuiDir_Left || g.Style.ColorButtonPosition == ImGuiDir_Right);
8745#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
8746 for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_COUNT; n++)
8747 IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < ImGuiKey_LegacyNativeKey_END && "io.KeyMap[] contains an out of bound value (need to be 0..511, or -1 for unmapped key)");
8748
8749 // Check: required key mapping (we intentionally do NOT check all keys to not pressure user into setting up everything, but Space is required and was only added in 1.60 WIP)
8750 if ((g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && g.IO.BackendUsingLegacyKeyArrays == 1)
8751 IM_ASSERT(g.IO.KeyMap[ImGuiKey_Space] != -1 && "ImGuiKey_Space is not mapped, required for keyboard navigation.");
8752#endif
8753
8754 // Check: the io.ConfigWindowsResizeFromEdges option requires backend to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly.
8755 if (g.IO.ConfigWindowsResizeFromEdges && !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseCursors))
8756 g.IO.ConfigWindowsResizeFromEdges = false;
8757}
8758
8759static void ImGui::ErrorCheckEndFrameSanityChecks()
8760{

Callers

nothing calls this directly

Calls 1

IsBuiltMethod · 0.80

Tested by

no test coverage detected