Examples: Updated for reorganized context functions. Calling CreateContext(), DestroyContext() in example code. Removed Shutdown() from binding code. (#1565, #586, #992, #1007, #1558)
diff --git a/examples/allegro5_example/imgui_impl_a5.cpp b/examples/allegro5_example/imgui_impl_a5.cpp
index 62f7af6..dddb4c3 100644
--- a/examples/allegro5_example/imgui_impl_a5.cpp
+++ b/examples/allegro5_example/imgui_impl_a5.cpp
@@ -200,7 +200,6 @@
 void ImGui_ImplA5_Shutdown()
 {
     ImGui_ImplA5_InvalidateDeviceObjects();
-    ImGui::Shutdown();
 }
 
 // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
diff --git a/examples/allegro5_example/main.cpp b/examples/allegro5_example/main.cpp
index 3c9c977..11ec724 100644
--- a/examples/allegro5_example/main.cpp
+++ b/examples/allegro5_example/main.cpp
@@ -23,6 +23,7 @@
     al_register_event_source(queue, al_get_mouse_event_source());
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplA5_Init(display);
 
     // Setup style
@@ -109,6 +110,7 @@
 
     // Cleanup
     ImGui_ImplA5_Shutdown();
+    ImGui::DestroyContext();
     al_destroy_event_queue(queue);
     al_destroy_display(display);
 
diff --git a/examples/directx10_example/imgui_impl_dx10.cpp b/examples/directx10_example/imgui_impl_dx10.cpp
index 14a47c4..66b411e 100644
--- a/examples/directx10_example/imgui_impl_dx10.cpp
+++ b/examples/directx10_example/imgui_impl_dx10.cpp
@@ -569,7 +569,6 @@
 void ImGui_ImplDX10_Shutdown()
 {
     ImGui_ImplDX10_InvalidateDeviceObjects();
-    ImGui::Shutdown();
     g_pd3dDevice = NULL;
     g_hWnd = (HWND)0;
 }
diff --git a/examples/directx10_example/main.cpp b/examples/directx10_example/main.cpp
index 38f4054..8b54fab 100644
--- a/examples/directx10_example/main.cpp
+++ b/examples/directx10_example/main.cpp
@@ -122,6 +122,7 @@
     UpdateWindow(hwnd);
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplDX10_Init(hwnd, g_pd3dDevice);
 
     // Setup style
@@ -204,6 +205,8 @@
     }
 
     ImGui_ImplDX10_Shutdown();
+    ImGui::DestroyContext();
+
     CleanupDeviceD3D();
     UnregisterClass(_T("ImGui Example"), wc.hInstance);
 
diff --git a/examples/directx11_example/imgui_impl_dx11.cpp b/examples/directx11_example/imgui_impl_dx11.cpp
index 4963fc1..61860f5 100644
--- a/examples/directx11_example/imgui_impl_dx11.cpp
+++ b/examples/directx11_example/imgui_impl_dx11.cpp
@@ -571,7 +571,6 @@
 void ImGui_ImplDX11_Shutdown()
 {
     ImGui_ImplDX11_InvalidateDeviceObjects();
-    ImGui::Shutdown();
     g_pd3dDevice = NULL;
     g_pd3dDeviceContext = NULL;
     g_hWnd = (HWND)0;
diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp
index 79e7bb1..84db742 100644
--- a/examples/directx11_example/main.cpp
+++ b/examples/directx11_example/main.cpp
@@ -125,6 +125,7 @@
     UpdateWindow(hwnd);
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplDX11_Init(hwnd, g_pd3dDevice, g_pd3dDeviceContext);
 
     // Setup style
@@ -207,6 +208,8 @@
     }
 
     ImGui_ImplDX11_Shutdown();
+    ImGui::DestroyContext();
+
     CleanupDeviceD3D();
     UnregisterClass(_T("ImGui Example"), wc.hInstance);
 
diff --git a/examples/directx9_example/imgui_impl_dx9.cpp b/examples/directx9_example/imgui_impl_dx9.cpp
index a4e6769..af30fbf 100644
--- a/examples/directx9_example/imgui_impl_dx9.cpp
+++ b/examples/directx9_example/imgui_impl_dx9.cpp
@@ -288,7 +288,6 @@
 void ImGui_ImplDX9_Shutdown()
 {
     ImGui_ImplDX9_InvalidateDeviceObjects();
-    ImGui::Shutdown();
     g_pd3dDevice = NULL;
     g_hWnd = 0;
 }
diff --git a/examples/directx9_example/main.cpp b/examples/directx9_example/main.cpp
index 09a109d..64159b9 100644
--- a/examples/directx9_example/main.cpp
+++ b/examples/directx9_example/main.cpp
@@ -75,6 +75,7 @@
     }
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplDX9_Init(hwnd, g_pd3dDevice);
 
     // Setup style
@@ -173,6 +174,8 @@
     }
 
     ImGui_ImplDX9_Shutdown();
+    ImGui::DestroyContext();
+
     if (g_pd3dDevice) g_pd3dDevice->Release();
     if (pD3D) pD3D->Release();
     UnregisterClass(_T("ImGui Example"), wc.hInstance);
diff --git a/examples/marmalade_example/imgui_impl_marmalade.cpp b/examples/marmalade_example/imgui_impl_marmalade.cpp
index 36fc832..0ce0edc 100644
--- a/examples/marmalade_example/imgui_impl_marmalade.cpp
+++ b/examples/marmalade_example/imgui_impl_marmalade.cpp
@@ -207,8 +207,6 @@
 
 bool    ImGui_Marmalade_Init(bool install_callbacks)
 {
-    IwGxInit();
-
     ImGuiIO& io = ImGui::GetIO();
     io.KeyMap[ImGuiKey_Tab] = s3eKeyTab;                     // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
     io.KeyMap[ImGuiKey_LeftArrow] = s3eKeyLeft;
@@ -248,8 +246,6 @@
 void ImGui_Marmalade_Shutdown()
 {
     ImGui_Marmalade_InvalidateDeviceObjects();
-    ImGui::Shutdown();
-    IwGxTerminate();
 }
 
 void ImGui_Marmalade_NewFrame()
diff --git a/examples/marmalade_example/main.cpp b/examples/marmalade_example/main.cpp
index 2b5edb7..4ad1fe2 100644
--- a/examples/marmalade_example/main.cpp
+++ b/examples/marmalade_example/main.cpp
@@ -14,7 +14,10 @@
 
 int main(int, char**)
 {
+    IwGxInit();
+
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_Marmalade_Init(true);
 
     // Setup style
@@ -95,6 +98,8 @@
 
     // Cleanup
     ImGui_Marmalade_Shutdown();
+    ImGui::DestroyContext();
+    IwGxTerminate();
 
     return 0;
 }
diff --git a/examples/null_example/main.cpp b/examples/null_example/main.cpp
index 04c1bda..f60b805 100644
--- a/examples/null_example/main.cpp
+++ b/examples/null_example/main.cpp
@@ -4,6 +4,7 @@
 
 int main(int, char**)
 {
+    ImGui::CreateContext();
     ImGuiIO& io = ImGui::GetIO();
 
     // Build atlas
@@ -27,7 +28,7 @@
         ImGui::Render();
     }
 
-    printf("Shutdown()\n");
-    ImGui::Shutdown();
+    printf("DestroyContext()\n");
+    ImGui::DestroyContext();
     return 0;
 }
diff --git a/examples/opengl2_example/imgui_impl_glfw_gl2.cpp b/examples/opengl2_example/imgui_impl_glfw_gl2.cpp
index e5fe2f4..4c450ed 100644
--- a/examples/opengl2_example/imgui_impl_glfw_gl2.cpp
+++ b/examples/opengl2_example/imgui_impl_glfw_gl2.cpp
@@ -246,7 +246,6 @@
 void ImGui_ImplGlfwGL2_Shutdown()
 {
     ImGui_ImplGlfwGL2_InvalidateDeviceObjects();
-    ImGui::Shutdown();
 }
 
 void ImGui_ImplGlfwGL2_NewFrame()
diff --git a/examples/opengl2_example/main.cpp b/examples/opengl2_example/main.cpp
index 6359f5b..ef4f876 100644
--- a/examples/opengl2_example/main.cpp
+++ b/examples/opengl2_example/main.cpp
@@ -27,6 +27,7 @@
     glfwSwapInterval(1); // Enable vsync
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplGlfwGL2_Init(window, true);
 
     // Setup style
@@ -105,6 +106,7 @@
 
     // Cleanup
     ImGui_ImplGlfwGL2_Shutdown();
+    ImGui::DestroyContext();
     glfwTerminate();
 
     return 0;
diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp
index a71fc51..3b39e18 100644
--- a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp
+++ b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp
@@ -358,7 +358,6 @@
 void ImGui_ImplGlfwGL3_Shutdown()
 {
     ImGui_ImplGlfwGL3_InvalidateDeviceObjects();
-    ImGui::Shutdown();
 }
 
 void ImGui_ImplGlfwGL3_NewFrame()
diff --git a/examples/opengl3_example/main.cpp b/examples/opengl3_example/main.cpp
index 6beb855..7c29cb7 100644
--- a/examples/opengl3_example/main.cpp
+++ b/examples/opengl3_example/main.cpp
@@ -32,6 +32,7 @@
     gl3wInit();
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplGlfwGL3_Init(window, true);
 
     // Setup style
@@ -109,6 +110,7 @@
 
     // Cleanup
     ImGui_ImplGlfwGL3_Shutdown();
+    ImGui::DestroyContext();
     glfwTerminate();
 
     return 0;
diff --git a/examples/sdl_opengl2_example/imgui_impl_sdl_gl2.cpp b/examples/sdl_opengl2_example/imgui_impl_sdl_gl2.cpp
index 76def29..f937bcc 100644
--- a/examples/sdl_opengl2_example/imgui_impl_sdl_gl2.cpp
+++ b/examples/sdl_opengl2_example/imgui_impl_sdl_gl2.cpp
@@ -245,7 +245,6 @@
 void ImGui_ImplSdlGL2_Shutdown()
 {
     ImGui_ImplSdlGL2_InvalidateDeviceObjects();
-    ImGui::Shutdown();
 }
 
 void ImGui_ImplSdlGL2_NewFrame(SDL_Window *window)
diff --git a/examples/sdl_opengl2_example/main.cpp b/examples/sdl_opengl2_example/main.cpp
index 21b567a..115dfc6 100644
--- a/examples/sdl_opengl2_example/main.cpp
+++ b/examples/sdl_opengl2_example/main.cpp
@@ -33,6 +33,7 @@
     SDL_GLContext glcontext = SDL_GL_CreateContext(window);
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplSdlGL2_Init(window);
 
     // Setup style
@@ -116,6 +117,8 @@
 
     // Cleanup
     ImGui_ImplSdlGL2_Shutdown();
+    ImGui::DestroyContext();
+
     SDL_GL_DeleteContext(glcontext);
     SDL_DestroyWindow(window);
     SDL_Quit();
diff --git a/examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp b/examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp
index 35d9cdd..a8c1363 100644
--- a/examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp
+++ b/examples/sdl_opengl3_example/imgui_impl_sdl_gl3.cpp
@@ -356,7 +356,6 @@
 void ImGui_ImplSdlGL3_Shutdown()
 {
     ImGui_ImplSdlGL3_InvalidateDeviceObjects();
-    ImGui::Shutdown();
 }
 
 void ImGui_ImplSdlGL3_NewFrame(SDL_Window* window)
diff --git a/examples/sdl_opengl3_example/main.cpp b/examples/sdl_opengl3_example/main.cpp
index 7ee6038..3cd0716 100644
--- a/examples/sdl_opengl3_example/main.cpp
+++ b/examples/sdl_opengl3_example/main.cpp
@@ -33,6 +33,7 @@
     gl3wInit();
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplSdlGL3_Init(window);
 
     // Setup style
@@ -115,6 +116,8 @@
 
     // Cleanup
     ImGui_ImplSdlGL3_Shutdown();
+    ImGui::DestroyContext();
+
     SDL_GL_DeleteContext(glcontext);
     SDL_DestroyWindow(window);
     SDL_Quit();
diff --git a/examples/vulkan_example/imgui_impl_glfw_vulkan.cpp b/examples/vulkan_example/imgui_impl_glfw_vulkan.cpp
index b9e6d78..caf0312 100644
--- a/examples/vulkan_example/imgui_impl_glfw_vulkan.cpp
+++ b/examples/vulkan_example/imgui_impl_glfw_vulkan.cpp
@@ -787,7 +787,6 @@
 void ImGui_ImplGlfwVulkan_Shutdown()
 {
     ImGui_ImplGlfwVulkan_InvalidateDeviceObjects();
-    ImGui::Shutdown();
 }
 
 void ImGui_ImplGlfwVulkan_NewFrame()
diff --git a/examples/vulkan_example/main.cpp b/examples/vulkan_example/main.cpp
index 6c4ef33..b75fdaf 100644
--- a/examples/vulkan_example/main.cpp
+++ b/examples/vulkan_example/main.cpp
@@ -615,6 +615,7 @@
     setup_vulkan(window);
 
     // Setup ImGui binding
+    ImGui::CreateContext();
     ImGui_ImplGlfwVulkan_Init_Data init_data = {};
     init_data.allocator = g_Allocator;
     init_data.gpu = g_Gpu;
@@ -737,6 +738,7 @@
     VkResult err = vkDeviceWaitIdle(g_Device);
     check_vk_result(err);
     ImGui_ImplGlfwVulkan_Shutdown();
+    ImGui::DestroyContext();
     cleanup_vulkan();
     glfwTerminate();