From 632f9ec36ab9fc2b7f3ec2459a7fce252a0b73d1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 30 Nov 2015 09:45:45 +0000 Subject: [PATCH] Commenting asserts --- imgui.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index f2496e45..61550831 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -489,6 +489,7 @@ - style: store rounded corners in texture to use 1 quad per corner (filled and wireframe). so rounding have minor cost. - style: color-box not always square? - style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc. + - style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation). - text: simple markup language for color change? - font: helper to add glyph redirect/replacements (e.g. redirect alternate apostrophe unicode code points to ascii one, etc.) - log: LogButtons() options for specifying depth and/or hiding depth slider @@ -1856,11 +1857,11 @@ void ImGui::NewFrame() ImGuiState& g = *GImGui; // Check user data - IM_ASSERT(g.IO.DeltaTime >= 0.0f); + IM_ASSERT(g.IO.DeltaTime >= 0.0f); // Need a positive DeltaTime (zero is tolerated but will cause some timing issues) IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f); IM_ASSERT(g.IO.Fonts->Fonts.Size > 0); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? - IM_ASSERT(g.Style.CurveTessellationTol > 0.0f); // Invalid + IM_ASSERT(g.Style.CurveTessellationTol > 0.0f); // Invalid style setting if (!g.Initialized) { @@ -2278,7 +2279,7 @@ static void AddDrawListToRenderList(ImVector& out_render_list, ImDr // If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly. const unsigned long long int max_vtx_idx = (unsigned long long int)1L << (sizeof(ImDrawIdx)*8); (void)max_vtx_idx; - IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); + IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); // Too many vertices in same ImDrawList GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size; GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size; @@ -2347,7 +2348,7 @@ void ImGui::EndFrame() } // Hide implicit "Debug" window if it hasn't been used - IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin/End + IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls if (g.CurrentWindow && !g.CurrentWindow->Accessed) g.CurrentWindow->Active = false; ImGui::End(); @@ -3084,7 +3085,7 @@ void ImGui::BeginTooltip() void ImGui::EndTooltip() { - IM_ASSERT(GetCurrentWindowRead()->Flags & ImGuiWindowFlags_Tooltip); + IM_ASSERT(GetCurrentWindowRead()->Flags & ImGuiWindowFlags_Tooltip); // Mismatched BeginTooltip()/EndTooltip() calls ImGui::End(); } @@ -3253,7 +3254,7 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_opened, ImGuiWindowFlags e void ImGui::EndPopup() { ImGuiWindow* window = GetCurrentWindow(); - IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); + IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls IM_ASSERT(GImGui->CurrentPopupStack.Size > 0); ImGui::End(); if (!(window->Flags & ImGuiWindowFlags_Modal)) @@ -3331,7 +3332,7 @@ void ImGui::EndChild() { ImGuiWindow* window = GetCurrentWindow(); - IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); + IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss if ((window->Flags & ImGuiWindowFlags_ComboBox) || window->BeginCount > 1) { ImGui::End(); @@ -8666,7 +8667,7 @@ void ImGui::EndGroup() ImGuiWindow* window = GetCurrentWindow(); ImGuiStyle& style = ImGui::GetStyle(); - IM_ASSERT(!window->DC.GroupStack.empty()); + IM_ASSERT(!window->DC.GroupStack.empty()); // Mismatched BeginGroup()/EndGroup() calls ImGuiGroupData& group_data = window->DC.GroupStack.back();