Skip to content

Commit

Permalink
Fix access violation/assert due to enum variants after COUNT variant
Browse files Browse the repository at this point in the history
  • Loading branch information
kavika13 committed Sep 17, 2024
1 parent 4329204 commit 334bf58
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Libraries/imgui-1.85/imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ enum ImGuiDataType_
ImGuiDataType_U64, // unsigned long long / unsigned __int64
ImGuiDataType_Float, // float
ImGuiDataType_Double, // double
ImGuiDataType_COUNT
ImGuiDataType_COUNT // DO NOT place enum values after this, unless they're just aliases for other earlier enum values. This is used for an array size
};

// A cardinal direction
Expand All @@ -1340,7 +1340,7 @@ enum ImGuiDir_
ImGuiDir_Right = 1,
ImGuiDir_Up = 2,
ImGuiDir_Down = 3,
ImGuiDir_COUNT
ImGuiDir_COUNT // DO NOT place enum values after this, unless they're just aliases for other earlier enum values. This is used for an array size
};

// A sorting direction
Expand Down Expand Up @@ -1376,11 +1376,10 @@ enum ImGuiKey_
ImGuiKey_X, // for text edit CTRL+X: cut
ImGuiKey_Y, // for text edit CTRL+Y: redo
ImGuiKey_Z, // for text edit CTRL+Z: undo
ImGuiKey_COUNT,
ImGuiKey_LShift,
ImGuiKey_RShift,
ImGuiKey_NumEnter

ImGuiKey_NumEnter,
ImGuiKey_COUNT // DO NOT place enum values after this, unless they're just aliases for other earlier enum values. This is used for an array size
};

// To test io.KeyMods (which is a combination of individual fields io.KeyCtrl, io.KeyShift, io.KeyAlt set by user/backend)
Expand Down Expand Up @@ -1423,7 +1422,7 @@ enum ImGuiNavInput_
ImGuiNavInput_KeyRight_, // move right
ImGuiNavInput_KeyUp_, // move up
ImGuiNavInput_KeyDown_, // move down
ImGuiNavInput_COUNT,
ImGuiNavInput_COUNT, // DO NOT place enum values after this, unless they're just aliases for other earlier enum values. This is used for an array size
ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyLeft_
};

Expand Down Expand Up @@ -1509,7 +1508,7 @@ enum ImGuiCol_
ImGuiCol_NavWindowingHighlight, // Highlight window when using CTRL+TAB
ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active
ImGuiCol_ModalWindowDimBg, // Darken/colorize entire screen behind a modal window, when one is active
ImGuiCol_COUNT
ImGuiCol_COUNT // DO NOT place enum values after this, unless they're just aliases for other earlier enum values. This is used for an array size
};

// Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure.
Expand Down Expand Up @@ -1547,7 +1546,7 @@ enum ImGuiStyleVar_
ImGuiStyleVar_TabRounding, // float TabRounding
ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign
ImGuiStyleVar_SelectableTextAlign, // ImVec2 SelectableTextAlign
ImGuiStyleVar_COUNT
ImGuiStyleVar_COUNT // DO NOT place enum values after this, unless they're just aliases for other earlier enum values. This is used for an array size
};

// Flags for InvisibleButton() [extended in imgui_internal.h]
Expand Down Expand Up @@ -1633,7 +1632,7 @@ enum ImGuiMouseButton_
ImGuiMouseButton_Left = 0,
ImGuiMouseButton_Right = 1,
ImGuiMouseButton_Middle = 2,
ImGuiMouseButton_COUNT = 5
ImGuiMouseButton_COUNT = 5 // DO NOT place enum values after this, unless they're just aliases for other earlier enum values. This is used for an array size
};

// Enumeration for GetMouseCursor()
Expand All @@ -1650,7 +1649,7 @@ enum ImGuiMouseCursor_
ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window
ImGuiMouseCursor_Hand, // (Unused by Dear ImGui functions. Use for e.g. hyperlinks)
ImGuiMouseCursor_NotAllowed, // When hovering something with disallowed interaction. Usually a crossed circle.
ImGuiMouseCursor_COUNT
ImGuiMouseCursor_COUNT // DO NOT place enum values after this, unless they're just aliases for other earlier enum values. This is used for an array size
};

// Enumeration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions
Expand Down

0 comments on commit 334bf58

Please sign in to comment.