瀏覽代碼

Updated ImGui.

Бранимир Караџић 5 年之前
父節點
當前提交
db781c76a2

+ 5 - 1
3rdparty/dear-imgui/imgui.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.75 WIP
+// dear imgui, v1.75
 // (main code and documentation)
 // (main code and documentation)
 
 
 // Help:
 // Help:
@@ -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
@@ -10284,3 +10286,5 @@ void ImGui::ShowMetricsWindow(bool*) { }
 #endif
 #endif
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE

+ 7 - 3
3rdparty/dear-imgui/imgui.h

@@ -1,4 +1,4 @@
-// dear imgui, v1.75 WIP
+// dear imgui, v1.75
 // (headers)
 // (headers)
 
 
 // Help:
 // Help:
@@ -45,6 +45,8 @@ Index of this file:
 #include "imconfig.h"
 #include "imconfig.h"
 #endif
 #endif
 
 
+#ifndef IMGUI_DISABLE
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // Header mess
 // Header mess
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -57,8 +59,8 @@ Index of this file:
 
 
 // Version
 // Version
 // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
 // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
-#define IMGUI_VERSION               "1.75 WIP"
-#define IMGUI_VERSION_NUM           17401
+#define IMGUI_VERSION               "1.75"
+#define IMGUI_VERSION_NUM           17500
 #define IMGUI_CHECKVERSION()        ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
 #define IMGUI_CHECKVERSION()        ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
 
 
 // Define attributes of all API symbols declarations (e.g. for DLL under Windows)
 // Define attributes of all API symbols declarations (e.g. for DLL under Windows)
@@ -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

+ 5 - 1
3rdparty/dear-imgui/imgui_demo.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.75 WIP
+// dear imgui, v1.75
 // (demo code)
 // (demo code)
 
 
 // Help:
 // Help:
@@ -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

+ 9 - 4
3rdparty/dear-imgui/imgui_draw.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.75 WIP
+// dear imgui, v1.75
 // (drawing and font code)
 // (drawing and font code)
 
 
 /*
 /*
@@ -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
@@ -358,7 +360,7 @@ ImDrawListSharedData::ImDrawListSharedData()
         const float a = ((float)i * 2 * IM_PI) / (float)IM_ARRAYSIZE(CircleVtx12);
         const float a = ((float)i * 2 * IM_PI) / (float)IM_ARRAYSIZE(CircleVtx12);
         CircleVtx12[i] = ImVec2(ImCos(a), ImSin(a));
         CircleVtx12[i] = ImVec2(ImCos(a), ImSin(a));
     }
     }
-    memset(CircleSegmentCounts, 0, sizeof(CircleSegmentCounts)); // This will be set by 
+    memset(CircleSegmentCounts, 0, sizeof(CircleSegmentCounts)); // This will be set by SetCircleSegmentMaxError()
 }
 }
 
 
 void ImDrawListSharedData::SetCircleSegmentMaxError(float max_error)
 void ImDrawListSharedData::SetCircleSegmentMaxError(float max_error)
@@ -1940,7 +1942,7 @@ bool    ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
 {
 {
     IM_ASSERT(atlas->ConfigData.Size > 0);
     IM_ASSERT(atlas->ConfigData.Size > 0);
 
 
-    ImFontAtlasBuildRegisterDefaultCustomRects(atlas);
+    ImFontAtlasBuildInit(atlas);
 
 
     // Clear atlas
     // Clear atlas
     atlas->TexID = (ImTextureID)NULL;
     atlas->TexID = (ImTextureID)NULL;
@@ -2192,7 +2194,8 @@ bool    ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
     return true;
     return true;
 }
 }
 
 
-void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas)
+// Register default custom rectangles (this is called/shared by both the stb_truetype and the FreeType builder)
+void ImFontAtlasBuildInit(ImFontAtlas* atlas)
 {
 {
     if (atlas->CustomRectIds[0] >= 0)
     if (atlas->CustomRectIds[0] >= 0)
         return;
         return;
@@ -3458,3 +3461,5 @@ static const char* GetDefaultCompressedFontDataTTFBase85()
 {
 {
     return proggy_clean_ttf_compressed_data_base85;
     return proggy_clean_ttf_compressed_data_base85;
 }
 }
+
+#endif // #ifndef IMGUI_DISABLE

+ 5 - 2
3rdparty/dear-imgui/imgui_internal.h

@@ -1,4 +1,4 @@
-// dear imgui, v1.75 WIP
+// dear imgui, v1.75
 // (internal structures/api)
 // (internal structures/api)
 
 
 // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
 // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
@@ -22,6 +22,7 @@ Index of this file:
 */
 */
 
 
 #pragma once
 #pragma once
+#ifndef IMGUI_DISABLE
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // Header mess
 // Header mess
@@ -1867,7 +1868,7 @@ namespace ImGui
 
 
 // ImFontAtlas internals
 // ImFontAtlas internals
 IMGUI_API bool              ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas);
 IMGUI_API bool              ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas);
-IMGUI_API void              ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas);
+IMGUI_API void              ImFontAtlasBuildInit(ImFontAtlas* atlas);
 IMGUI_API void              ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent);
 IMGUI_API void              ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent);
 IMGUI_API void              ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque);
 IMGUI_API void              ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque);
 IMGUI_API void              ImFontAtlasBuildFinish(ImFontAtlas* atlas);
 IMGUI_API void              ImFontAtlasBuildFinish(ImFontAtlas* atlas);
@@ -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

+ 12 - 3
3rdparty/dear-imgui/imgui_widgets.cpp

@@ -1,4 +1,4 @@
-// dear imgui, v1.75 WIP
+// dear imgui, v1.75
 // (widgets code)
 // (widgets code)
 
 
 /*
 /*
@@ -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
@@ -3872,7 +3874,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
         }
         }
 
 
         // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.
         // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.
-        // If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. Also this allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage.
+        // If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. 
+        // This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize).
         bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
         bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
         if (apply_edit_back_to_user_buffer)
         if (apply_edit_back_to_user_buffer)
         {
         {
@@ -3966,8 +3969,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
         // Copy result to user buffer
         // Copy result to user buffer
         if (apply_new_text)
         if (apply_new_text)
         {
         {
+            // We cannot test for 'backup_current_text_length != apply_new_text_length' here because we have no guarantee that the size
+            // of our owned buffer matches the size of the string object held by the user, and by design we allow InputText() to be used
+            // without any storage on user's side.
             IM_ASSERT(apply_new_text_length >= 0);
             IM_ASSERT(apply_new_text_length >= 0);
-            if (backup_current_text_length != apply_new_text_length && is_resizable)
+            if (is_resizable)
             {
             {
                 ImGuiInputTextCallbackData callback_data;
                 ImGuiInputTextCallbackData callback_data;
                 callback_data.EventFlag = ImGuiInputTextFlags_CallbackResize;
                 callback_data.EventFlag = ImGuiInputTextFlags_CallbackResize;
@@ -3982,6 +3988,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
                 apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1);
                 apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1);
                 IM_ASSERT(apply_new_text_length <= buf_size);
                 IM_ASSERT(apply_new_text_length <= buf_size);
             }
             }
+            //IMGUI_DEBUG_LOG("InputText(\"%s\"): apply_new_text length %d\n", label, apply_new_text_length);
 
 
             // If the underlying buffer resize was denied or not carried to the next frame, apply_new_text_length+1 may be >= buf_size.
             // If the underlying buffer resize was denied or not carried to the next frame, apply_new_text_length+1 may be >= buf_size.
             ImStrncpy(buf, apply_new_text, ImMin(apply_new_text_length + 1, buf_size));
             ImStrncpy(buf, apply_new_text, ImMin(apply_new_text_length + 1, buf_size));
@@ -7714,3 +7721,5 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
 }
 }
 
 
 //-------------------------------------------------------------------------
 //-------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE