From 2142181c515b8a985bec075ee589c7b76298b9fa Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Mar 2015 12:08:00 -0700 Subject: [PATCH 1/2] Allow to disable help and test window functionality --- imconfig.h | 3 +++ imgui.cpp | 2 ++ imgui.h | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/imconfig.h b/imconfig.h index bcb0972e..c924d6f8 100644 --- a/imconfig.h +++ b/imconfig.h @@ -22,6 +22,9 @@ //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS +//---- Don't implement help and test window functionality (ShowUserGuide, ShowStyleEditor and ShowTestWindow methods won't be available) +//#define IMGUI_DISABLE_TEST_WINDOWS + //---- Include imgui_user.inl at the end of imgui.cpp so you can include code that extends ImGui using its private data/functions. //#define IMGUI_INCLUDE_IMGUI_USER_INL diff --git a/imgui.cpp b/imgui.cpp index ac65304a..0dccd5bb 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8778,6 +8778,7 @@ static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y) #endif +#ifndef IMGUI_DISABLE_TEST_WINDOWS //----------------------------------------------------------------------------- // HELP //----------------------------------------------------------------------------- @@ -10308,6 +10309,7 @@ static void ShowExampleAppLongText(bool* opened) } // End of Sample code +#endif //----------------------------------------------------------------------------- // FONT DATA diff --git a/imgui.h b/imgui.h index 8f28d5fd..778dea15 100644 --- a/imgui.h +++ b/imgui.h @@ -155,10 +155,11 @@ namespace ImGui IMGUI_API void NewFrame(); IMGUI_API void Render(); IMGUI_API void Shutdown(); +#ifndef IMGUI_DISABLE_TEST_WINDOWS IMGUI_API void ShowUserGuide(); IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); IMGUI_API void ShowTestWindow(bool* open = NULL); - +#endif // Window // See implementation in .cpp for details IMGUI_API bool Begin(const char* name = "Debug", bool* p_opened = NULL, const ImVec2& initial_size = ImVec2(0,0), float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code. passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed. From 6699ccfd1fa5e9b1d36157ca6485f8e47d222b3d Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 20 Mar 2015 22:52:32 +0000 Subject: [PATCH 2/2] Tweaked IMGUI_DISABLE_TEST_WINDOWS so it doesn't show in ImGui.h --- imconfig.h | 2 +- imgui.cpp | 9 ++++++++- imgui.h | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/imconfig.h b/imconfig.h index c924d6f8..a07a1331 100644 --- a/imconfig.h +++ b/imconfig.h @@ -22,7 +22,7 @@ //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS -//---- Don't implement help and test window functionality (ShowUserGuide, ShowStyleEditor and ShowTestWindow methods won't be available) +//---- Don't implement help and test window functionality (ShowUserGuide()/ShowStyleEditor()/ShowTestWindow() methods will be empty) //#define IMGUI_DISABLE_TEST_WINDOWS //---- Include imgui_user.inl at the end of imgui.cpp so you can include code that extends ImGui using its private data/functions. diff --git a/imgui.cpp b/imgui.cpp index ce4afbc4..526ff293 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8807,7 +8807,14 @@ static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y) #endif -#ifndef IMGUI_DISABLE_TEST_WINDOWS +#ifdef IMGUI_DISABLE_TEST_WINDOWS + +void ImGui::ShowUserGuide() {} +void ImGui::ShowStyleEditor() {} +void ImGui::ShowTestWindow() {} + +#else + //----------------------------------------------------------------------------- // HELP //----------------------------------------------------------------------------- diff --git a/imgui.h b/imgui.h index df196325..3319624b 100644 --- a/imgui.h +++ b/imgui.h @@ -155,11 +155,10 @@ namespace ImGui IMGUI_API void NewFrame(); IMGUI_API void Render(); IMGUI_API void Shutdown(); -#ifndef IMGUI_DISABLE_TEST_WINDOWS IMGUI_API void ShowUserGuide(); IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); IMGUI_API void ShowTestWindow(bool* open = NULL); -#endif + // Window // See implementation in .cpp for details IMGUI_API bool Begin(const char* name = "Debug", bool* p_opened = NULL, const ImVec2& initial_size = ImVec2(0,0), float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code. passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.