diff --git a/backends/imgui_impl_allegro5.cpp b/backends/imgui_impl_allegro5.cpp index 542fe1293..3797402b8 100644 --- a/backends/imgui_impl_allegro5.cpp +++ b/backends/imgui_impl_allegro5.cpp @@ -71,7 +71,7 @@ struct ImGui_ImplAllegro5_Data ALLEGRO_VERTEX_DECL* VertexDecl; char* ClipboardTextData; - ImGui_ImplAllegro5_Data() { memset(this, 0, sizeof(*this)); } + ImGui_ImplAllegro5_Data() { memset((void*)this, 0, sizeof(*this)); } }; // Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts diff --git a/backends/imgui_impl_dx10.cpp b/backends/imgui_impl_dx10.cpp index 79bf731d0..09e019872 100644 --- a/backends/imgui_impl_dx10.cpp +++ b/backends/imgui_impl_dx10.cpp @@ -59,7 +59,7 @@ struct ImGui_ImplDX10_Data int VertexBufferSize; int IndexBufferSize; - ImGui_ImplDX10_Data() { memset(this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } + ImGui_ImplDX10_Data() { memset((void*)this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } }; struct VERTEX_CONSTANT_BUFFER diff --git a/backends/imgui_impl_dx11.cpp b/backends/imgui_impl_dx11.cpp index 3f628cbc8..a7407d668 100644 --- a/backends/imgui_impl_dx11.cpp +++ b/backends/imgui_impl_dx11.cpp @@ -60,7 +60,7 @@ struct ImGui_ImplDX11_Data int VertexBufferSize; int IndexBufferSize; - ImGui_ImplDX11_Data() { memset(this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } + ImGui_ImplDX11_Data() { memset((void*)this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } }; struct VERTEX_CONSTANT_BUFFER diff --git a/backends/imgui_impl_dx12.cpp b/backends/imgui_impl_dx12.cpp index e9d2e9613..6b9d29ecc 100644 --- a/backends/imgui_impl_dx12.cpp +++ b/backends/imgui_impl_dx12.cpp @@ -71,7 +71,7 @@ struct ImGui_ImplDX12_Data UINT numFramesInFlight; UINT frameIndex; - ImGui_ImplDX12_Data() { memset(this, 0, sizeof(*this)); frameIndex = UINT_MAX; } + ImGui_ImplDX12_Data() { memset((void*)this, 0, sizeof(*this)); frameIndex = UINT_MAX; } }; struct VERTEX_CONSTANT_BUFFER diff --git a/backends/imgui_impl_dx9.cpp b/backends/imgui_impl_dx9.cpp index 4cbd7959d..6aca8a9fd 100644 --- a/backends/imgui_impl_dx9.cpp +++ b/backends/imgui_impl_dx9.cpp @@ -46,7 +46,7 @@ struct ImGui_ImplDX9_Data int VertexBufferSize; int IndexBufferSize; - ImGui_ImplDX9_Data() { memset(this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } + ImGui_ImplDX9_Data() { memset((void*)this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } }; struct CUSTOMVERTEX diff --git a/backends/imgui_impl_glfw.cpp b/backends/imgui_impl_glfw.cpp index 516aa3c25..6cdf74948 100644 --- a/backends/imgui_impl_glfw.cpp +++ b/backends/imgui_impl_glfw.cpp @@ -105,7 +105,7 @@ struct ImGui_ImplGlfw_Data GLFWcharfun PrevUserCallbackChar; GLFWmonitorfun PrevUserCallbackMonitor; - ImGui_ImplGlfw_Data() { memset(this, 0, sizeof(*this)); } + ImGui_ImplGlfw_Data() { memset((void*)this, 0, sizeof(*this)); } }; // Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts diff --git a/backends/imgui_impl_opengl2.cpp b/backends/imgui_impl_opengl2.cpp index 17a6faebb..6b135bc50 100644 --- a/backends/imgui_impl_opengl2.cpp +++ b/backends/imgui_impl_opengl2.cpp @@ -61,7 +61,7 @@ struct ImGui_ImplOpenGL2_Data { GLuint FontTexture; - ImGui_ImplOpenGL2_Data() { memset(this, 0, sizeof(*this)); } + ImGui_ImplOpenGL2_Data() { memset((void*)this, 0, sizeof(*this)); } }; // Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts diff --git a/backends/imgui_impl_opengl3.cpp b/backends/imgui_impl_opengl3.cpp index 0d3489ce8..8f800f308 100644 --- a/backends/imgui_impl_opengl3.cpp +++ b/backends/imgui_impl_opengl3.cpp @@ -193,7 +193,7 @@ struct ImGui_ImplOpenGL3_Data GLsizeiptr IndexBufferSize; bool HasClipOrigin; - ImGui_ImplOpenGL3_Data() { memset(this, 0, sizeof(*this)); } + ImGui_ImplOpenGL3_Data() { memset((void*)this, 0, sizeof(*this)); } }; // Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts diff --git a/backends/imgui_impl_sdl.cpp b/backends/imgui_impl_sdl.cpp index ef5ef6091..223ce1588 100644 --- a/backends/imgui_impl_sdl.cpp +++ b/backends/imgui_impl_sdl.cpp @@ -87,7 +87,7 @@ struct ImGui_ImplSDL2_Data char* ClipboardTextData; bool MouseCanUseGlobalState; - ImGui_ImplSDL2_Data() { memset(this, 0, sizeof(*this)); } + ImGui_ImplSDL2_Data() { memset((void*)this, 0, sizeof(*this)); } }; // Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts diff --git a/backends/imgui_impl_sdlrenderer.cpp b/backends/imgui_impl_sdlrenderer.cpp index 8d20b0438..8a54567b0 100644 --- a/backends/imgui_impl_sdlrenderer.cpp +++ b/backends/imgui_impl_sdlrenderer.cpp @@ -42,7 +42,7 @@ struct ImGui_ImplSDLRenderer_Data { SDL_Renderer* SDLRenderer; SDL_Texture* FontTexture; - ImGui_ImplSDLRenderer_Data() { memset(this, 0, sizeof(*this)); } + ImGui_ImplSDLRenderer_Data() { memset((void*)this, 0, sizeof(*this)); } }; // Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts diff --git a/backends/imgui_impl_vulkan.cpp b/backends/imgui_impl_vulkan.cpp index dbd8b1842..a4bddc071 100644 --- a/backends/imgui_impl_vulkan.cpp +++ b/backends/imgui_impl_vulkan.cpp @@ -118,7 +118,7 @@ struct ImGui_ImplVulkan_Data ImGui_ImplVulkan_Data() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); BufferMemoryAlignment = 256; } }; diff --git a/backends/imgui_impl_vulkan.h b/backends/imgui_impl_vulkan.h index d80bfc4e6..f2f3e345f 100644 --- a/backends/imgui_impl_vulkan.h +++ b/backends/imgui_impl_vulkan.h @@ -147,7 +147,7 @@ struct ImGui_ImplVulkanH_Window ImGui_ImplVulkanH_Window() { - memset(this, 0, sizeof(*this)); + memset((void*)this, 0, sizeof(*this)); PresentMode = VK_PRESENT_MODE_MAX_ENUM_KHR; ClearEnable = true; } diff --git a/backends/imgui_impl_win32.cpp b/backends/imgui_impl_win32.cpp index ee951fc7a..8977a1f6c 100644 --- a/backends/imgui_impl_win32.cpp +++ b/backends/imgui_impl_win32.cpp @@ -94,7 +94,7 @@ struct ImGui_ImplWin32_Data PFN_XInputGetState XInputGetState; #endif - ImGui_ImplWin32_Data() { memset(this, 0, sizeof(*this)); } + ImGui_ImplWin32_Data() { memset((void*)this, 0, sizeof(*this)); } }; // Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts diff --git a/imgui.cpp b/imgui.cpp index d53653d97..a7cbfb820 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8069,7 +8069,6 @@ void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, voi IM_ASSERT(window->IsFallbackWindow); break; } - IM_ASSERT(window == g.CurrentWindow); if (window->Flags & ImGuiWindowFlags_ChildWindow) { if (log_callback) log_callback(user_data, "Recovered from missing EndChild() for '%s'", window->Name); diff --git a/imgui.h b/imgui.h index 20e1bfcf7..7fc4ba683 100644 --- a/imgui.h +++ b/imgui.h @@ -2342,13 +2342,13 @@ struct ImGuiListClipper // **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. Explicitly cast to ImU32 or ImVec4 if needed. struct ImColor { - ImVec4 Value; + ImVec4 Value; - ImColor() { Value.x = Value.y = Value.z = Value.w = 0.0f; } + constexpr ImColor() { } + constexpr ImColor(float r, float g, float b, float a = 1.0f) : Value(r, g, b, a) { } + constexpr ImColor(const ImVec4& col) : Value(col) {} ImColor(int r, int g, int b, int a = 255) { float sc = 1.0f / 255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; } ImColor(ImU32 rgba) { float sc = 1.0f / 255.0f; Value.x = (float)((rgba >> IM_COL32_R_SHIFT) & 0xFF) * sc; Value.y = (float)((rgba >> IM_COL32_G_SHIFT) & 0xFF) * sc; Value.z = (float)((rgba >> IM_COL32_B_SHIFT) & 0xFF) * sc; Value.w = (float)((rgba >> IM_COL32_A_SHIFT) & 0xFF) * sc; } - ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; } - ImColor(const ImVec4& col) { Value = col; } inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } inline operator ImVec4() const { return Value; } diff --git a/imgui_demo.cpp b/imgui_demo.cpp index fc2f4ccea..5f9742d10 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -3873,7 +3873,7 @@ static void ShowDemoWindowTables() sprintf(buf, "Hello %d,%d", column, row); if (contents_type == CT_Text) ImGui::TextUnformatted(buf); - else if (contents_type) + else if (contents_type == CT_FillButton) ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f)); } } diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 10f670c23..e9197586a 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -3878,7 +3878,7 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im draw_list->PathFillConvex(col); } -void ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding) +void ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, const ImRect& outer, const ImRect& inner, ImU32 col, float rounding) { const bool fill_L = (inner.Min.x > outer.Min.x); const bool fill_R = (inner.Max.x < outer.Max.x); diff --git a/imgui_internal.h b/imgui_internal.h index 9fd04d842..75092ccfc 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -232,7 +232,7 @@ namespace ImStb #define IM_NEWLINE "\n" #endif #define IM_TABSIZE (4) -#define IM_MEMALIGN(_OFF,_ALIGN) (((_OFF) + (_ALIGN - 1)) & ~(_ALIGN - 1)) // Memory align e.g. IM_ALIGN(0,4)=0, IM_ALIGN(1,4)=4, IM_ALIGN(4,4)=4, IM_ALIGN(5,4)=8 +#define IM_MEMALIGN(_OFF,_ALIGN) (((_OFF) + ((_ALIGN) - 1)) & ~((_ALIGN) - 1)) // Memory align e.g. IM_ALIGN(0,4)=0, IM_ALIGN(1,4)=4, IM_ALIGN(4,4)=4, IM_ALIGN(5,4)=8 #define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose #define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255 #define IM_FLOOR(_VAL) ((float)(int)(_VAL)) // ImFloor() is not inlined in MSVC debug builds @@ -2782,7 +2782,7 @@ namespace ImGui IMGUI_API void RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz); IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col); IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding); - IMGUI_API void RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding); + IMGUI_API void RenderRectFilledWithHole(ImDrawList* draw_list, const ImRect& outer, const ImRect& inner, ImU32 col, float rounding); #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS // [1.71: 2019/06/07: Updating prototypes of some of the internal functions. Leaving those for reference for a short while] diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 86229b21e..407ae51c4 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -843,9 +843,8 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos) // Render ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); ImU32 text_col = GetColorU32(ImGuiCol_Text); - ImVec2 center = bb.GetCenter(); if (hovered || held) - window->DrawList->AddCircleFilled(center/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12); + window->DrawList->AddCircleFilled(bb.GetCenter()/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12); RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f); // Switch to moving the window after mouse is moved beyond the initial drag threshold diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index a72ec8c83..4066a9a6c 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -368,7 +368,7 @@ struct ImFontBuildSrcGlyphFT uint32_t Codepoint; unsigned int* BitmapData; // Point within one of the dst_tmp_bitmap_buffers[] array - ImFontBuildSrcGlyphFT() { memset(this, 0, sizeof(*this)); } + ImFontBuildSrcGlyphFT() { memset((void*)this, 0, sizeof(*this)); } }; struct ImFontBuildSrcDataFT