diff --git a/imgui.cpp b/imgui.cpp index 01d81ec..ec19efe 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1609,8 +1609,16 @@ return GImGui; } -void ImGui::SetInternalState(void* state) +unsigned ImGui::GetInternalStateSize() { + return sizeof(ImGuiState); +} + +void ImGui::SetInternalState(void* state, bool construct) +{ + if( construct ) + new (state) ImGuiState; + GImGui = (ImGuiState*)state; } diff --git a/imgui.cpp b/imgui.cpp index 01d81ec..ec19efe 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1609,8 +1609,16 @@ return GImGui; } -void ImGui::SetInternalState(void* state) +unsigned ImGui::GetInternalStateSize() { + return sizeof(ImGuiState); +} + +void ImGui::SetInternalState(void* state, bool construct) +{ + if( construct ) + new (state) ImGuiState; + GImGui = (ImGuiState*)state; } diff --git a/imgui.h b/imgui.h index 7110bd7..4b5e052 100644 --- a/imgui.h +++ b/imgui.h @@ -144,7 +144,8 @@ { // Main IMGUI_API void* GetInternalState(); - IMGUI_API void SetInternalState(void* state); + IMGUI_API unsigned GetInternalStateSize(); + IMGUI_API void SetInternalState(void* state, bool construct = false); IMGUI_API ImGuiIO& GetIO(); IMGUI_API ImGuiStyle& GetStyle(); IMGUI_API void NewFrame();