浏览代码

Added IMGUI_DISABLE compile-time definition to make all headers and sources empty.

omar 5 年之前
父节点
当前提交
d37d25470a
共有 9 个文件被更改,包括 31 次插入4 次删除
  1. 1 0
      docs/CHANGELOG.txt
  2. 1 0
      docs/TODO.txt
  3. 6 4
      imconfig.h
  4. 4 0
      imgui.cpp
  5. 4 0
      imgui.h
  6. 4 0
      imgui_demo.cpp
  7. 4 0
      imgui_draw.cpp
  8. 3 0
      imgui_internal.h
  9. 4 0
      imgui_widgets.cpp

+ 1 - 0
docs/CHANGELOG.txt

@@ -95,6 +95,7 @@ Other Changes:
 - Columns: ImDrawList::Channels* functions now work inside columns. Added extra comments to
 - Columns: ImDrawList::Channels* functions now work inside columns. Added extra comments to
   suggest using user-owned ImDrawListSplitter instead of ImDrawList functions. [@rokups]
   suggest using user-owned ImDrawListSplitter instead of ImDrawList functions. [@rokups]
 - Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups]
 - Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups]
+- Misc: Added IMGUI_DISABLE compile-time definition to make all headers and sources empty.
 - Misc: Disable format checks when using stb_printf, to allow using extra formats.
 - Misc: Disable format checks when using stb_printf, to allow using extra formats.
   Made IMGUI_USE_STB_SPRINTF a properly documented imconfig.h flag. (#2954) [@loicmolinari]
   Made IMGUI_USE_STB_SPRINTF a properly documented imconfig.h flag. (#2954) [@loicmolinari]
 - Misc: Added misc/single_file/imgui_single_file.h, We use this to validate compiling all *.cpp
 - Misc: Added misc/single_file/imgui_single_file.h, We use this to validate compiling all *.cpp

+ 1 - 0
docs/TODO.txt

@@ -80,6 +80,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
  - input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
  - input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
  - input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
  - input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
  - input text: expose CursorPos in char filter event (#816)
  - input text: expose CursorPos in char filter event (#816)
+ - input text: try usage idiom of using InputText with data only exposed through get/set accessors, without extraneous copy/alloc. (#3009)
  - input text: access public fields via a non-callback API e.g. InputTextGetState("xxx") that may return NULL if not active.
  - input text: access public fields via a non-callback API e.g. InputTextGetState("xxx") that may return NULL if not active.
  - input text: flag to disable live update of the user buffer (also applies to float/int text input) (#701)
  - input text: flag to disable live update of the user buffer (also applies to float/int text input) (#701)
  - input text: hover tooltip could show unclamped text
  - input text: hover tooltip could show unclamped text

+ 6 - 4
imconfig.h

@@ -14,6 +14,7 @@
 #pragma once
 #pragma once
 
 
 //---- Define assertion handler. Defaults to calling assert().
 //---- Define assertion handler. Defaults to calling assert().
+// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
 //#define IM_ASSERT(_EXPR)  MyAssert(_EXPR)
 //#define IM_ASSERT(_EXPR)  MyAssert(_EXPR)
 //#define IM_ASSERT(_EXPR)  ((void)(_EXPR))     // Disable asserts
 //#define IM_ASSERT(_EXPR)  ((void)(_EXPR))     // Disable asserts
 
 
@@ -25,10 +26,11 @@
 //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
 //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
 //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
 //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
 
 
-//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
-// It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp.
-//#define IMGUI_DISABLE_DEMO_WINDOWS
-//#define IMGUI_DISABLE_METRICS_WINDOW
+//---- Disable all of Dear ImGui or don't implement standard windows. 
+// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
+//#define IMGUI_DISABLE                                     // Disable everything: all headers and source files will be empty. 
+//#define IMGUI_DISABLE_DEMO_WINDOWS                        // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. 
+//#define IMGUI_DISABLE_METRICS_WINDOW                      // Disable debug/metrics window: ShowMetricsWindow() will be empty.
 
 
 //---- Don't implement some functions to reduce linkage requirements.
 //---- Don't implement some functions to reduce linkage requirements.
 //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS   // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
 //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS   // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.

+ 4 - 0
imgui.cpp

@@ -791,6 +791,8 @@ CODE
 #endif
 #endif
 
 
 #include "imgui.h"
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
+
 #ifndef IMGUI_DEFINE_MATH_OPERATORS
 #ifndef IMGUI_DEFINE_MATH_OPERATORS
 #define IMGUI_DEFINE_MATH_OPERATORS
 #define IMGUI_DEFINE_MATH_OPERATORS
 #endif
 #endif
@@ -10282,3 +10284,5 @@ void ImGui::ShowMetricsWindow(bool*) { }
 #endif
 #endif
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 0
imgui.h

@@ -45,6 +45,8 @@ Index of this file:
 #include "imconfig.h"
 #include "imconfig.h"
 #endif
 #endif
 
 
+#ifndef IMGUI_DISABLE
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // Header mess
 // Header mess
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -2275,3 +2277,5 @@ struct ImFont
 #ifdef IMGUI_INCLUDE_IMGUI_USER_H
 #ifdef IMGUI_INCLUDE_IMGUI_USER_H
 #include "imgui_user.h"
 #include "imgui_user.h"
 #endif
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 0
imgui_demo.cpp

@@ -65,6 +65,8 @@ Index of this file:
 #endif
 #endif
 
 
 #include "imgui.h"
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
+
 #include <ctype.h>          // toupper
 #include <ctype.h>          // toupper
 #include <limits.h>         // INT_MIN, INT_MAX
 #include <limits.h>         // INT_MIN, INT_MAX
 #include <math.h>           // sqrtf, powf, cosf, sinf, floorf, ceilf
 #include <math.h>           // sqrtf, powf, cosf, sinf, floorf, ceilf
@@ -4866,3 +4868,5 @@ void ImGui::ShowUserGuide() {}
 void ImGui::ShowStyleEditor(ImGuiStyle*) {}
 void ImGui::ShowStyleEditor(ImGuiStyle*) {}
 
 
 #endif
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 0
imgui_draw.cpp

@@ -27,6 +27,8 @@ Index of this file:
 #endif
 #endif
 
 
 #include "imgui.h"
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
+
 #ifndef IMGUI_DEFINE_MATH_OPERATORS
 #ifndef IMGUI_DEFINE_MATH_OPERATORS
 #define IMGUI_DEFINE_MATH_OPERATORS
 #define IMGUI_DEFINE_MATH_OPERATORS
 #endif
 #endif
@@ -3458,3 +3460,5 @@ static const char* GetDefaultCompressedFontDataTTFBase85()
 {
 {
     return proggy_clean_ttf_compressed_data_base85;
     return proggy_clean_ttf_compressed_data_base85;
 }
 }
+
+#endif // #ifndef IMGUI_DISABLE

+ 3 - 0
imgui_internal.h

@@ -22,6 +22,7 @@ Index of this file:
 */
 */
 
 
 #pragma once
 #pragma once
+#ifndef IMGUI_DISABLE
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // Header mess
 // Header mess
@@ -1912,3 +1913,5 @@ extern void                 ImGuiTestEngineHook_Log(ImGuiContext* ctx, const cha
 #ifdef _MSC_VER
 #ifdef _MSC_VER
 #pragma warning (pop)
 #pragma warning (pop)
 #endif
 #endif
+
+#endif // #ifndef IMGUI_DISABLE

+ 4 - 0
imgui_widgets.cpp

@@ -33,6 +33,8 @@ Index of this file:
 #endif
 #endif
 
 
 #include "imgui.h"
 #include "imgui.h"
+#ifndef IMGUI_DISABLE
+
 #ifndef IMGUI_DEFINE_MATH_OPERATORS
 #ifndef IMGUI_DEFINE_MATH_OPERATORS
 #define IMGUI_DEFINE_MATH_OPERATORS
 #define IMGUI_DEFINE_MATH_OPERATORS
 #endif
 #endif
@@ -7704,3 +7706,5 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
 }
 }
 
 
 //-------------------------------------------------------------------------
 //-------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE