Added asserts to catch illegal modifications of the font atlas between NewFrame() and EndFrame()/Render(). (#1958)

This commit is contained in:
omar
2018-07-22 18:53:27 +02:00
parent e07f5d4c78
commit 4ebd442a24
3 changed files with 14 additions and 0 deletions

View File

@ -3810,6 +3810,7 @@ void ImGui::NewFrame()
g.WindowsActiveCount = 0;
// Setup current font and draw list
g.IO.Fonts->Locked = true;
SetCurrentFont(GetDefaultFont());
IM_ASSERT(g.Font->IsLoaded());
g.DrawListSharedData.ClipRectFullscreen = ImVec4(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y);
@ -4451,6 +4452,9 @@ void ImGui::EndFrame()
IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong
g.Windows.swap(g.WindowsSortBuffer);
// Unlock font atlas
g.IO.Fonts->Locked = false;
// Clear Input data for next frame
g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f;
memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));