From 1b86e7343fea755e8a948fd1102d549665c4c134 Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 24 Dec 2017 18:16:22 +0100 Subject: [PATCH] Renamed the emblematic ShowTestWindow() function to ShowDemoWindow(). Kept redirection function (will obsolete). --- README.md | 2 +- examples/allegro5_example/main.cpp | 10 +++++----- .../apple_example/imguiex-ios/debug_hud.cpp | 6 +++--- .../apple_example/imguiex-ios/debug_hud.h | 2 +- examples/directx10_example/main.cpp | 10 +++++----- examples/directx11_example/main.cpp | 10 +++++----- examples/directx9_example/main.cpp | 10 +++++----- examples/marmalade_example/main.cpp | 10 +++++----- examples/null_example/main.cpp | 2 +- examples/opengl2_example/main.cpp | 10 +++++----- examples/opengl3_example/main.cpp | 10 +++++----- examples/sdl_opengl2_example/main.cpp | 10 +++++----- examples/sdl_opengl3_example/main.cpp | 10 +++++----- examples/vulkan_example/main.cpp | 10 +++++----- imconfig.h | 6 +++--- imgui.cpp | 7 ++++--- imgui.h | 5 +++-- imgui_demo.cpp | 20 +++++++++++-------- 18 files changed, 78 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 29fcab16..6ababf5b 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ Frequently Asked Question (FAQ) Where is the documentation? - The documentation is at the top of imgui.cpp + effectively imgui.h. -- Example code is in imgui_demo.cpp and particularly the ImGui::ShowTestWindow() function. It covers most features of ImGui so you can read the code and call the function itself to see its output. +- Example code is in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function. It covers most features of ImGui so you can read the code and call the function itself to see its output. - Standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder. - We obviously needs better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort. diff --git a/examples/allegro5_example/main.cpp b/examples/allegro5_example/main.cpp index 4eb9a4aa..f9abe756 100644 --- a/examples/allegro5_example/main.cpp +++ b/examples/allegro5_example/main.cpp @@ -41,7 +41,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -75,7 +75,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f/ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -88,11 +88,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/apple_example/imguiex-ios/debug_hud.cpp b/examples/apple_example/imguiex-ios/debug_hud.cpp index fff26eee..c451322a 100644 --- a/examples/apple_example/imguiex-ios/debug_hud.cpp +++ b/examples/apple_example/imguiex-ios/debug_hud.cpp @@ -9,7 +9,7 @@ void DebugHUD_InitDefaults( DebugHUD *hud ) { - hud->show_test_window = true; + hud->show_demo_window = true; hud->show_example_window = true; hud->rotation_speed = 15.0f; @@ -26,10 +26,10 @@ void DebugHUD_InitDefaults( DebugHUD *hud ) void DebugHUD_DoInterface(DebugHUD *hud) { - if (hud->show_test_window) + if (hud->show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&hud->show_test_window ); + ImGui::ShowDemoWindow(&hud->show_demo_window ); } if (hud->show_example_window) diff --git a/examples/apple_example/imguiex-ios/debug_hud.h b/examples/apple_example/imguiex-ios/debug_hud.h index 17122f5e..601376c3 100644 --- a/examples/apple_example/imguiex-ios/debug_hud.h +++ b/examples/apple_example/imguiex-ios/debug_hud.h @@ -6,7 +6,7 @@ typedef struct DebugHUD { - bool show_test_window; + bool show_demo_window; bool show_example_window; float rotation_speed; float cubeColor1[4]; diff --git a/examples/directx10_example/main.cpp b/examples/directx10_example/main.cpp index 3ece69f9..1d7da4b0 100644 --- a/examples/directx10_example/main.cpp +++ b/examples/directx10_example/main.cpp @@ -141,7 +141,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -169,7 +169,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -182,11 +182,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp index 9bd8637c..1c6f84a2 100644 --- a/examples/directx11_example/main.cpp +++ b/examples/directx11_example/main.cpp @@ -144,7 +144,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -172,7 +172,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -185,11 +185,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/directx9_example/main.cpp b/examples/directx9_example/main.cpp index af53ddb3..7ada228d 100644 --- a/examples/directx9_example/main.cpp +++ b/examples/directx9_example/main.cpp @@ -93,7 +93,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -123,7 +123,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -136,11 +136,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/marmalade_example/main.cpp b/examples/marmalade_example/main.cpp index f87b3bc5..032e4198 100644 --- a/examples/marmalade_example/main.cpp +++ b/examples/marmalade_example/main.cpp @@ -33,7 +33,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -58,7 +58,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -71,11 +71,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/null_example/main.cpp b/examples/null_example/main.cpp index b12f75c9..04c1bda4 100644 --- a/examples/null_example/main.cpp +++ b/examples/null_example/main.cpp @@ -22,7 +22,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); - ImGui::ShowTestWindow(NULL); + ImGui::ShowDemoWindow(NULL); ImGui::Render(); } diff --git a/examples/opengl2_example/main.cpp b/examples/opengl2_example/main.cpp index ed8f1a7b..35c8d19c 100644 --- a/examples/opengl2_example/main.cpp +++ b/examples/opengl2_example/main.cpp @@ -45,7 +45,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -66,7 +66,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -79,11 +79,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/opengl3_example/main.cpp b/examples/opengl3_example/main.cpp index 062843d6..d10d5830 100644 --- a/examples/opengl3_example/main.cpp +++ b/examples/opengl3_example/main.cpp @@ -50,7 +50,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -71,7 +71,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -84,11 +84,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/sdl_opengl2_example/main.cpp b/examples/sdl_opengl2_example/main.cpp index 77241a5b..cc7c5fb7 100644 --- a/examples/sdl_opengl2_example/main.cpp +++ b/examples/sdl_opengl2_example/main.cpp @@ -51,7 +51,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -79,7 +79,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -92,11 +92,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/sdl_opengl3_example/main.cpp b/examples/sdl_opengl3_example/main.cpp index e51b3208..a9e75fd4 100644 --- a/examples/sdl_opengl3_example/main.cpp +++ b/examples/sdl_opengl3_example/main.cpp @@ -51,7 +51,7 @@ int main(int, char**) //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -79,7 +79,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -92,11 +92,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } // Rendering diff --git a/examples/vulkan_example/main.cpp b/examples/vulkan_example/main.cpp index 9d54976a..ec83035f 100644 --- a/examples/vulkan_example/main.cpp +++ b/examples/vulkan_example/main.cpp @@ -668,7 +668,7 @@ int main(int, char**) ImGui_ImplGlfwVulkan_InvalidateFontUploadObjects(); } - bool show_test_window = true; + bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); @@ -700,7 +700,7 @@ int main(int, char**) ImGui::Text("Hello, world!"); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ImGui::ColorEdit3("clear color", (float*)&clear_color); - if (ImGui::Button("Test Window")) show_test_window ^= 1; + if (ImGui::Button("Demo Window")) show_demo_window ^= 1; if (ImGui::Button("Another Window")) show_another_window ^= 1; ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); } @@ -713,11 +713,11 @@ int main(int, char**) ImGui::End(); } - // 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow(). - if (show_test_window) + // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). + if (show_demo_window) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); - ImGui::ShowTestWindow(&show_test_window); + ImGui::ShowDemoWindow(&show_demo_window); } g_ClearValue.color.float32[0] = clear_color.x; diff --git a/imconfig.h b/imconfig.h index 85eff5fd..824a81af 100644 --- a/imconfig.h +++ b/imconfig.h @@ -23,9 +23,9 @@ //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS -//---- Don't implement test window functionality (ShowTestWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty) -//---- It is very strongly recommended to NOT disable the test windows. Please read the comment at the top of imgui_demo.cpp to learn why. -//#define IMGUI_DISABLE_TEST_WINDOWS +//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty) +//---- It is very strongly recommended to NOT disable the demo windows. Please read the comment at the top of imgui_demo.cpp to learn why. +//#define IMGUI_DISABLE_DEMO_WINDOWS //---- Don't implement ImFormatString(), ImFormatStringV() so you can reimplement them yourself. //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS diff --git a/imgui.cpp b/imgui.cpp index 393b4e50..14b2bd8c 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,7 +1,7 @@ // dear imgui, v1.53 WIP // (main code and documentation) -// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code. +// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code. // Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase. // Get latest version at https://github.com/ocornut/imgui // Releases change-log at https://github.com/ocornut/imgui/releases @@ -86,7 +86,7 @@ - Read the FAQ below this section! - Your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention on your side, no state duplication, less sync, less bugs. - - Call and read ImGui::ShowTestWindow() for demo code demonstrating most features. + - Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features. - You can learn about immediate-mode gui principles at http://www.johno.se/book/imgui.html or watch http://mollyrocket.com/861 HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI @@ -213,6 +213,7 @@ Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code. Also read releases logs https://github.com/ocornut/imgui/releases for more details. + - 2017/12/24 (1.53) - renamed the emblematic ShowTestWindow() function to ShowDemoWindow(). Kept redirection function (will obsolete). - 2017/12/21 (1.53) - ImDrawList: renamed style.AntiAliasedShapes to style.AntiAliasedFill for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags - 2017/12/21 (1.53) - ImDrawList: removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Prefer manipulating ImDrawList::Flags if you need to toggle them during the frame. - 2017/12/14 (1.53) - using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set. @@ -576,7 +577,7 @@ - tip: the ImGuiOnceUponAFrame helper will allow run the block of code only once a frame. You can use it to quickly add custom UI in the middle of a deep nested inner loop in your code. - tip: you can call Render() multiple times (e.g for VR renders). - - tip: call and read the ShowTestWindow() code in imgui_demo.cpp for more example of how to use ImGui! + - tip: call and read the ShowDemoWindow() code in imgui_demo.cpp for more example of how to use ImGui! */ diff --git a/imgui.h b/imgui.h index 33580dc2..10d46ab0 100644 --- a/imgui.h +++ b/imgui.h @@ -2,7 +2,7 @@ // (headers) // See imgui.cpp file for documentation. -// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code. +// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code. // Read 'Programmer guide' in imgui.cpp for notes on how to setup ImGui in your codebase. // Get latest version at https://github.com/ocornut/imgui @@ -136,7 +136,7 @@ namespace ImGui IMGUI_API void Shutdown(); // Demo, Debug, Informations - IMGUI_API void ShowTestWindow(bool* p_open = NULL); // create demo/test window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! + IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create metrics window. display ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc. IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) IMGUI_API bool ShowStyleSelector(const char* label); @@ -985,6 +985,7 @@ struct ImGuiIO #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS namespace ImGui { + static inline void ShowTestWindow() { return ShowDemoWindow(); } // OBSOLETE 1.53+ static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETE 1.53+ static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETE 1.53+ static inline void SetNextWindowContentWidth(float width) { SetNextWindowContentSize(ImVec2(width, 0.0f)); } // OBSOLETE 1.53+ (nb: original version preserved last Y value set by SetNextWindowContentSize()) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 0b329edc..204a1722 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -3,11 +3,11 @@ // Message to the person tempted to delete this file when integrating ImGui into their code base: // Don't do it! Do NOT remove this file from your project! It is useful reference code that you and other users will want to refer to. -// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowTestWindow(). -// During development, you can call ImGui::ShowTestWindow() in your code to learn about various features of ImGui. Have it wired in a debug menu! +// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow(). +// During development, you can call ImGui::ShowDemoWindow() in your code to learn about various features of ImGui. Have it wired in a debug menu! // Removing this file from your project is hindering access to documentation for everyone in your team, likely leading you to poorer usage of the library. -// Note that you can #define IMGUI_DISABLE_TEST_WINDOWS in imconfig.h for the same effect. -// If you want to link core ImGui in your public builds but not those test windows, #define IMGUI_DISABLE_TEST_WINDOWS in imconfig.h and those functions will be empty. +// Note that you can #define IMGUI_DISABLE_DEMO_WINDOWS in imconfig.h for the same effect. +// If you want to link core ImGui in your public builds but not those demo windows, #define IMGUI_DISABLE_DEMO_WINDOWS in imconfig.h and those functions will be empty. // For any other case, if you have ImGui available you probably want this to be available for reference and execution. // Thank you, // -Your beloved friend, imgui_demo.cpp (that you won't delete) @@ -70,7 +70,11 @@ // DEMO CODE //----------------------------------------------------------------------------- -#ifndef IMGUI_DISABLE_TEST_WINDOWS +#if !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && defined(IMGUI_DISABLE_TEST_WINDOWS) && !defined(IMGUI_DISABLE_DEMO_WINDOWS) // Obsolete name since 1.53, TEST->DEMO +#define IMGUI_DISABLE_DEMO_WINDOWS +#endif + +#if !defined(IMGUI_DISABLE_DEMO_WINDOWS) static void ShowExampleAppConsole(bool* p_open); static void ShowExampleAppLog(bool* p_open); @@ -121,7 +125,7 @@ void ImGui::ShowUserGuide() } // Demonstrate most ImGui features (big function!) -void ImGui::ShowTestWindow(bool* p_open) +void ImGui::ShowDemoWindow(bool* p_open) { // Examples apps static bool show_app_main_menu_bar = false; @@ -231,7 +235,7 @@ void ImGui::ShowTestWindow(bool* p_open) ImGui::Spacing(); if (ImGui::CollapsingHeader("Help")) { - ImGui::TextWrapped("This window is being created by the ShowTestWindow() function. Please refer to the code in imgui_demo.cpp for reference.\n\n"); + ImGui::TextWrapped("This window is being created by the ShowDemoWindow() function. Please refer to the code in imgui_demo.cpp for reference.\n\n"); ImGui::Text("USER GUIDE:"); ImGui::ShowUserGuide(); } @@ -3041,7 +3045,7 @@ static void ShowExampleAppLongText(bool* p_open) // End of Demo code #else -void ImGui::ShowTestWindow(bool*) {} +void ImGui::ShowDemoWindow(bool*) {} void ImGui::ShowUserGuide() {} void ImGui::ShowStyleEditor(ImGuiStyle*) {}