Added PushID(size_t sz) helper (may not be useful/meaningful for non C/C++ languages).

This commit is contained in:
omar 2019-01-27 15:44:57 +01:00
parent e55678adec
commit 20bc06af70
3 changed files with 9 additions and 0 deletions

View File

@ -37,6 +37,7 @@ Other Changes:
- Added .editorconfig file for text editors to standardize using spaces. (#2038) [@kudaba] - Added .editorconfig file for text editors to standardize using spaces. (#2038) [@kudaba]
- Fixed range-version of PushID() and GetID() not honoring the ### operator to restart from the seed value. - Fixed range-version of PushID() and GetID() not honoring the ### operator to restart from the seed value.
- Window: When resizing from an edge, the border is more visible and better follow the rounded corners. - Window: When resizing from an edge, the border is more visible and better follow the rounded corners.
- Added PushID(size_t sz) helper (may not be useful/meaningful for non C/C++ languages).
- ImDrawList: Fixed AddCircle(), AddCircleFilled() angle step being off, which was visible when drawing a "circle" - ImDrawList: Fixed AddCircle(), AddCircleFilled() angle step being off, which was visible when drawing a "circle"
with a small number of segments (e.g. an hexagon). (#2287) [@baktery] with a small number of segments (e.g. an hexagon). (#2287) [@baktery]
- ImGuiTextBuffer: Added append() function (unformatted). - ImGuiTextBuffer: Added append() function (unformatted).

View File

@ -6450,6 +6450,13 @@ void ImGui::PushID(const void* ptr_id)
window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id)); window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id));
} }
void ImGui::PushID(size_t int_id)
{
const void* ptr_id = (void*)int_id;
ImGuiWindow* window = GImGui->CurrentWindow;
window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id));
}
void ImGui::PushID(int int_id) void ImGui::PushID(int int_id)
{ {
const void* ptr_id = (void*)(intptr_t)int_id; const void* ptr_id = (void*)(intptr_t)int_id;

View File

@ -357,6 +357,7 @@ namespace ImGui
IMGUI_API void PushID(const char* str_id); // push string into the ID stack (will hash string). IMGUI_API void PushID(const char* str_id); // push string into the ID stack (will hash string).
IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); // push string into the ID stack (will hash string). IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); // push string into the ID stack (will hash string).
IMGUI_API void PushID(const void* ptr_id); // push pointer into the ID stack (will hash pointer). IMGUI_API void PushID(const void* ptr_id); // push pointer into the ID stack (will hash pointer).
IMGUI_API void PushID(size_t int_id); // push pointer into the ID stack (will hash integer).
IMGUI_API void PushID(int int_id); // push integer into the ID stack (will hash integer). IMGUI_API void PushID(int int_id); // push integer into the ID stack (will hash integer).
IMGUI_API void PopID(); // pop from the ID stack. IMGUI_API void PopID(); // pop from the ID stack.
IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself