mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 14:16:36 +00:00
Examples: Updated for reorganized context functions. Calling CreateContext(), DestroyContext() in example code. Removed Shutdown() from binding code. (#1565, #586, #992, #1007, #1558)
This commit is contained in:
parent
5e2aa6185c
commit
d3e826c247
@ -200,7 +200,6 @@ bool ImGui_ImplA5_Init(ALLEGRO_DISPLAY* display)
|
|||||||
void ImGui_ImplA5_Shutdown()
|
void ImGui_ImplA5_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplA5_InvalidateDeviceObjects();
|
ImGui_ImplA5_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
||||||
|
@ -23,6 +23,7 @@ int main(int, char**)
|
|||||||
al_register_event_source(queue, al_get_mouse_event_source());
|
al_register_event_source(queue, al_get_mouse_event_source());
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplA5_Init(display);
|
ImGui_ImplA5_Init(display);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -109,6 +110,7 @@ int main(int, char**)
|
|||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ImGui_ImplA5_Shutdown();
|
ImGui_ImplA5_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
al_destroy_event_queue(queue);
|
al_destroy_event_queue(queue);
|
||||||
al_destroy_display(display);
|
al_destroy_display(display);
|
||||||
|
|
||||||
|
@ -569,7 +569,6 @@ bool ImGui_ImplDX10_Init(void* hwnd, ID3D10Device* device)
|
|||||||
void ImGui_ImplDX10_Shutdown()
|
void ImGui_ImplDX10_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX10_InvalidateDeviceObjects();
|
ImGui_ImplDX10_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
g_pd3dDevice = NULL;
|
g_pd3dDevice = NULL;
|
||||||
g_hWnd = (HWND)0;
|
g_hWnd = (HWND)0;
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,7 @@ int main(int, char**)
|
|||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplDX10_Init(hwnd, g_pd3dDevice);
|
ImGui_ImplDX10_Init(hwnd, g_pd3dDevice);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -204,6 +205,8 @@ int main(int, char**)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui_ImplDX10_Shutdown();
|
ImGui_ImplDX10_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
CleanupDeviceD3D();
|
CleanupDeviceD3D();
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||||
|
|
||||||
|
@ -571,7 +571,6 @@ bool ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContex
|
|||||||
void ImGui_ImplDX11_Shutdown()
|
void ImGui_ImplDX11_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
g_pd3dDevice = NULL;
|
g_pd3dDevice = NULL;
|
||||||
g_pd3dDeviceContext = NULL;
|
g_pd3dDeviceContext = NULL;
|
||||||
g_hWnd = (HWND)0;
|
g_hWnd = (HWND)0;
|
||||||
|
@ -125,6 +125,7 @@ int main(int, char**)
|
|||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplDX11_Init(hwnd, g_pd3dDevice, g_pd3dDeviceContext);
|
ImGui_ImplDX11_Init(hwnd, g_pd3dDevice, g_pd3dDeviceContext);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -207,6 +208,8 @@ int main(int, char**)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui_ImplDX11_Shutdown();
|
ImGui_ImplDX11_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
CleanupDeviceD3D();
|
CleanupDeviceD3D();
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||||
|
|
||||||
|
@ -288,7 +288,6 @@ bool ImGui_ImplDX9_Init(void* hwnd, IDirect3DDevice9* device)
|
|||||||
void ImGui_ImplDX9_Shutdown()
|
void ImGui_ImplDX9_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX9_InvalidateDeviceObjects();
|
ImGui_ImplDX9_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
g_pd3dDevice = NULL;
|
g_pd3dDevice = NULL;
|
||||||
g_hWnd = 0;
|
g_hWnd = 0;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ int main(int, char**)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplDX9_Init(hwnd, g_pd3dDevice);
|
ImGui_ImplDX9_Init(hwnd, g_pd3dDevice);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -173,6 +174,8 @@ int main(int, char**)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui_ImplDX9_Shutdown();
|
ImGui_ImplDX9_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
if (g_pd3dDevice) g_pd3dDevice->Release();
|
if (g_pd3dDevice) g_pd3dDevice->Release();
|
||||||
if (pD3D) pD3D->Release();
|
if (pD3D) pD3D->Release();
|
||||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||||
|
@ -207,8 +207,6 @@ void ImGui_Marmalade_InvalidateDeviceObjects()
|
|||||||
|
|
||||||
bool ImGui_Marmalade_Init(bool install_callbacks)
|
bool ImGui_Marmalade_Init(bool install_callbacks)
|
||||||
{
|
{
|
||||||
IwGxInit();
|
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
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_Tab] = s3eKeyTab; // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
|
||||||
io.KeyMap[ImGuiKey_LeftArrow] = s3eKeyLeft;
|
io.KeyMap[ImGuiKey_LeftArrow] = s3eKeyLeft;
|
||||||
@ -248,8 +246,6 @@ bool ImGui_Marmalade_Init(bool install_callbacks)
|
|||||||
void ImGui_Marmalade_Shutdown()
|
void ImGui_Marmalade_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_Marmalade_InvalidateDeviceObjects();
|
ImGui_Marmalade_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
IwGxTerminate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_Marmalade_NewFrame()
|
void ImGui_Marmalade_NewFrame()
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
|
IwGxInit();
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_Marmalade_Init(true);
|
ImGui_Marmalade_Init(true);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -95,6 +98,8 @@ int main(int, char**)
|
|||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ImGui_Marmalade_Shutdown();
|
ImGui_Marmalade_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
IwGxTerminate();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
// Build atlas
|
// Build atlas
|
||||||
@ -27,7 +28,7 @@ int main(int, char**)
|
|||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Shutdown()\n");
|
printf("DestroyContext()\n");
|
||||||
ImGui::Shutdown();
|
ImGui::DestroyContext();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,6 @@ bool ImGui_ImplGlfwGL2_Init(GLFWwindow* window, bool install_callbacks)
|
|||||||
void ImGui_ImplGlfwGL2_Shutdown()
|
void ImGui_ImplGlfwGL2_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplGlfwGL2_InvalidateDeviceObjects();
|
ImGui_ImplGlfwGL2_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfwGL2_NewFrame()
|
void ImGui_ImplGlfwGL2_NewFrame()
|
||||||
|
@ -27,6 +27,7 @@ int main(int, char**)
|
|||||||
glfwSwapInterval(1); // Enable vsync
|
glfwSwapInterval(1); // Enable vsync
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplGlfwGL2_Init(window, true);
|
ImGui_ImplGlfwGL2_Init(window, true);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -105,6 +106,7 @@ int main(int, char**)
|
|||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ImGui_ImplGlfwGL2_Shutdown();
|
ImGui_ImplGlfwGL2_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -358,7 +358,6 @@ bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks)
|
|||||||
void ImGui_ImplGlfwGL3_Shutdown()
|
void ImGui_ImplGlfwGL3_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplGlfwGL3_InvalidateDeviceObjects();
|
ImGui_ImplGlfwGL3_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfwGL3_NewFrame()
|
void ImGui_ImplGlfwGL3_NewFrame()
|
||||||
|
@ -32,6 +32,7 @@ int main(int, char**)
|
|||||||
gl3wInit();
|
gl3wInit();
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplGlfwGL3_Init(window, true);
|
ImGui_ImplGlfwGL3_Init(window, true);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -109,6 +110,7 @@ int main(int, char**)
|
|||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ImGui_ImplGlfwGL3_Shutdown();
|
ImGui_ImplGlfwGL3_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -245,7 +245,6 @@ bool ImGui_ImplSdlGL2_Init(SDL_Window* window)
|
|||||||
void ImGui_ImplSdlGL2_Shutdown()
|
void ImGui_ImplSdlGL2_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplSdlGL2_InvalidateDeviceObjects();
|
ImGui_ImplSdlGL2_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplSdlGL2_NewFrame(SDL_Window *window)
|
void ImGui_ImplSdlGL2_NewFrame(SDL_Window *window)
|
||||||
|
@ -33,6 +33,7 @@ int main(int, char**)
|
|||||||
SDL_GLContext glcontext = SDL_GL_CreateContext(window);
|
SDL_GLContext glcontext = SDL_GL_CreateContext(window);
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplSdlGL2_Init(window);
|
ImGui_ImplSdlGL2_Init(window);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -116,6 +117,8 @@ int main(int, char**)
|
|||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ImGui_ImplSdlGL2_Shutdown();
|
ImGui_ImplSdlGL2_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
SDL_GL_DeleteContext(glcontext);
|
SDL_GL_DeleteContext(glcontext);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
@ -356,7 +356,6 @@ bool ImGui_ImplSdlGL3_Init(SDL_Window* window)
|
|||||||
void ImGui_ImplSdlGL3_Shutdown()
|
void ImGui_ImplSdlGL3_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplSdlGL3_InvalidateDeviceObjects();
|
ImGui_ImplSdlGL3_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplSdlGL3_NewFrame(SDL_Window* window)
|
void ImGui_ImplSdlGL3_NewFrame(SDL_Window* window)
|
||||||
|
@ -33,6 +33,7 @@ int main(int, char**)
|
|||||||
gl3wInit();
|
gl3wInit();
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplSdlGL3_Init(window);
|
ImGui_ImplSdlGL3_Init(window);
|
||||||
|
|
||||||
// Setup style
|
// Setup style
|
||||||
@ -115,6 +116,8 @@ int main(int, char**)
|
|||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ImGui_ImplSdlGL3_Shutdown();
|
ImGui_ImplSdlGL3_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
SDL_GL_DeleteContext(glcontext);
|
SDL_GL_DeleteContext(glcontext);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
@ -787,7 +787,6 @@ bool ImGui_ImplGlfwVulkan_Init(GLFWwindow* window, bool install_callbacks, Im
|
|||||||
void ImGui_ImplGlfwVulkan_Shutdown()
|
void ImGui_ImplGlfwVulkan_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplGlfwVulkan_InvalidateDeviceObjects();
|
ImGui_ImplGlfwVulkan_InvalidateDeviceObjects();
|
||||||
ImGui::Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplGlfwVulkan_NewFrame()
|
void ImGui_ImplGlfwVulkan_NewFrame()
|
||||||
|
@ -615,6 +615,7 @@ int main(int, char**)
|
|||||||
setup_vulkan(window);
|
setup_vulkan(window);
|
||||||
|
|
||||||
// Setup ImGui binding
|
// Setup ImGui binding
|
||||||
|
ImGui::CreateContext();
|
||||||
ImGui_ImplGlfwVulkan_Init_Data init_data = {};
|
ImGui_ImplGlfwVulkan_Init_Data init_data = {};
|
||||||
init_data.allocator = g_Allocator;
|
init_data.allocator = g_Allocator;
|
||||||
init_data.gpu = g_Gpu;
|
init_data.gpu = g_Gpu;
|
||||||
@ -737,6 +738,7 @@ int main(int, char**)
|
|||||||
VkResult err = vkDeviceWaitIdle(g_Device);
|
VkResult err = vkDeviceWaitIdle(g_Device);
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
ImGui_ImplGlfwVulkan_Shutdown();
|
ImGui_ImplGlfwVulkan_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
cleanup_vulkan();
|
cleanup_vulkan();
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user