NewFrame(): Added an assert to detect incorrect filling of the io.KeyMap[] array earlier. (#1555) + comments.

This commit is contained in:
omar
2018-01-18 10:06:58 +01:00
parent 60d5dc7902
commit 932d3f0198
2 changed files with 5 additions and 3 deletions

View File

@ -2282,6 +2282,8 @@ void ImGui::NewFrame()
IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting");
IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)");
IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
for (int n = 0; n < ImGuiKey_COUNT; n++)
IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)");
// Initialize on first frame
if (!g.Initialized)