From 2859f6723c13de3a9661b8087fb7919fa3796813 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 7 Oct 2026 19:50:23 +0200 Subject: [PATCH 01/72] Docs: fixed various comments. --- docs/CHANGELOG.txt | 25 ++++++++++++++----------- imgui.cpp | 6 +++--- imgui.h | 5 +++-- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index f93dfe8d6..5d01ea9ad 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -73,6 +73,9 @@ Use `ImDrawFlags_StrokeLegacy` mode to emulate old rendering: - Globally: ImGui::Checkbox("DefaultsToStrokeLegacy", &io.ConfigDebugDrawListDefaultsToStrokeLegacy); // Map to a checkbox - Globally: io.ConfigDebugDrawListDefaultsToStrokeLegacy = io.KeyShift; // Map on Shift +Don't panic! Many applications will not notice any difference! You will more likely +see differences if you used lots of direct `ImDrawList` calls for custom rendering. + Main work courtesy of @memononen. Additional work/reviewing/guidance by @ocornut. With legacy bits from @thedmd, @potocpav. @@ -85,7 +88,7 @@ Refer to our guides: - ImDrawList 1.92.9 vs 1.93.0 Interactive Testbed https://www.dearimgui.com/docs/drawlist_v193 - (interactively discuss and compare differences between 1.92.9 and 1.93.9) + (interactively discuss and compare differences between 1.92.9 and 1.93.0) (downloadable HTML file, may be used offline) - Pixel Perfect Anti-aliased Rendering @@ -100,7 +103,7 @@ Refer to our guides: Breaking Changes: -- DrawList: +- ImDrawList: - AddLine(): removed the (+0.5f,+0.5f) offset that was sneakily added to input coordinates. (#9504) - This fixes inconsistencies in the API and matches the PathXXX API. - By default, stroke thickness extends on both side of the given segment. @@ -134,21 +137,21 @@ Breaking Changes: - All closed shapes with thickness=1.0f will appear identical. - The difference for thickness>1.0f shapes may be minimal since very large strokes were not well supported for widgets, but stroke will default inside widgets. - - AddCircle(), AddNgon(): removed +0.5f offset added to radius. + - AddCircle(), AddNgon(): removed -0.5f offset added to radius. - This fixes inconsistencies in the API. - Use `ImDrawFlags_StrokeLegacy` to use old method if required. Or you can apply the offset manually! - AddRectFilled(): non-integer coordinates will now display anti-aliased edges. Previously, non-integer coordinates rendered with aliased edges snapped by the rasterizer. (#6971) - AddRect(), AddRectFilled(): rectangles with inverted coordinates won't be visible - unless using ImDrawList_StrokeLegacy mode. With inverted coordinates (min > max): + unless using ImDrawFlags_StrokeLegacy mode. With inverted coordinates (min > max): - Legacy `AddRect()` rounding off -> visible but incorrect outer size. - Legacy `AddRect()` rounding on -> visible but very glitchy. - Legacy `AddRectFilled()` rounding off -> visible and correct. - Legacy `AddRectFilled()` rounding on -> visible but very glitchy. - Use `ImDrawFlags_StrokeLegacy` to use old rendering for cases without rounding, or fix coordinates. - Merged `ImDrawListFlags` into `ImDrawFlags`. `ImDrawListFlags` was rarely used directly - and generally setup by the ImGui context. Keep inline redirection enums (will obsolete). + and generally setup by the ImGui context. - `ImDrawListFlags_AntiAliasedLines` -> `ImDrawFlags_AALines` - `ImDrawListFlags_AntiAliasedFill` -> `ImDrawFlags_AAFill` - `ImDrawListFlags_AllowVtxOffset` -> `ImDrawFlags_UseVtxOffset` @@ -171,10 +174,10 @@ Breaking Changes: obsolete, as the new line rendering code always uses textures. - Enabling `ImFontAtlasFlags_NoBakedLines` in the font atlas will now disable support for anti-aliased lines by clearing `style.AntiAliasedLines`/`style.AntiAliasedLineEnds`. -- Style: obsoleted `style.CurveTessellationTol (default 1.25)` which was in Pixels² unit in - favor of `style.CurveTessellationMaxError` (default 1.12)` which is in Pixels unit. It is +- Style: obsoleted `style.CurveTessellationTol` (default 1.25) which was in Pixels² unit in + favor of `style.CurveTessellationMaxError` (default 1.12) which is in Pixels unit. It is easier to tweak + this allows us to easily scale error threshold on high density screens. - - style.CurveTessellationMaxError == sqrf(style.CurveTessellationTol). + - style.CurveTessellationMaxError == sqrtf(style.CurveTessellationTol). - ImGuiTextFilter: removed `float width` parameter of `Draw(const char* filter, float width)`: prefer using `SetNextItemWidth(float)` which is standard. Kept inline redirection function. - Fonts: renamed `AddRemapChar()` to `AddRemapCodepoint()` (rarely used, marked internal). @@ -221,7 +224,7 @@ Other Changes: (#9504, #2183, #2964, #7972 + #9360, #6331, #4250, #4091) [@memononen] - Generally fixed rendering of thick strokes/paths. - The new stroke expansion now uses corner miter calculation, which keeps thickness along - the line segments consistent. If the corner becomes too sharp, it will be bevelled to + the line segments consistent. If the corner becomes too sharp, it will be beveled to avoid long spikes at corners. - There are also some robustness measures for the case where the line thickness is larger than the features being drawn. @@ -233,7 +236,7 @@ Other Changes: work precisely the same regardless of graphics API. (#3116, #3258, #2441) [@memononen] - Debug: added `io.ConfigDebugDrawListDefaultsToStrokeLegacy` to facilitate comparing old/new behaviors. This is equivalent to calling `PushDrawFlag(ImDrawFlags_StrokeLegacy, true)` - on every drawlist. + on every drawlists. Suggested uses, e.g. - `io.ConfigDebugDrawListDefaultsToStrokeLegacy = io.KeyShift; // Map on holding Shift` - `ImGui::Checkbox("DefaultsToStrokeLegacy", &io.ConfigDebugDrawListDefaultsToStrokeLegacy);` @@ -292,7 +295,7 @@ Other Changes: which may make them appear as protruding a little more. - About disabling anti-aliasing: - Disabling anti-aliasing is now emulated by applying different UV coordinates. - - It does not result in a performance increase or vertex/index data decrease any more. + - It does not result in a performance increase or vertex/index data decrease any more (however the tendency is that the new code behaves better than old code). - But may be a useful stylistic choice in some circumstances. - Many thick shapes had broken corners with old no-AA code, and the old no-AA code diff --git a/imgui.cpp b/imgui.cpp index 5b7d0c068..5bf2ec239 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -415,7 +415,7 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures: - AddRect(), AddCircle(), AddNgon(), AddEllipse(), AddTriangle(), AddQuad(): defaulting to "inside" stroke. All closed shapes with thickness=1.0f will appear identical. The difference for thickness>1.0f shapes may be minimal since very large strokes were not well supported for widgets, but stroke will default inside widgets. - AddCircle(), AddNgon(): removed +0.5f offset added to radius. This fixes inconsistencies in the API. Use `ImDrawFlags_StrokeLegacy` to use old method if required. Or you can apply the offset manually! - AddRectFilled(): non-integer coordinates will now display anti-aliased edges. Previously, non-integer coordinates rendered with aliased edges snapped by the rasterizer. - - AddRect(), AddRectFilled(): rectangles with inverted coordinates won't be visible unless using ImDrawList_StrokeLegacy mode. + - AddRect(), AddRectFilled(): rectangles with inverted coordinates won't be visible unless using ImDrawFlags_StrokeLegacy mode. With inverted coordinates: - Legacy `AddRect()` rounding off -> visible but incorrect outer size. - Legacy `AddRect()` rounding on -> visible but very glitchy. @@ -438,8 +438,8 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures: - obsoleted style.AntiAliasedLinesUseTex and ImDrawListFlags_AntiAliasedLinesUseTex, as the new line rendering code always uses textures. - 2026/09/30 (1.93.0) - ImFont: renamed `AddRemapChar()` to `AddRemapCodepoint()` (rarely used, marked internal). (#609, #5748) - 2026/09/18 (1.93.0) - ImGuiTextFilter: removed `float width` parameter of `Draw(const char* filter, float width)`: prefer using `SetNextItemWidth(float)` which is standard. Kept inline redirection function. - - 2026/08/03 (1.93.0) - Style: obsoleted `style.CurveTessellationTol (default 1.25)` which was in Pixels² unit in favor of `style.CurveTessellationMaxError` (default 1.12)` which is in Pixels unit. - - style.CurveTessellationMaxError == sqrf(style.CurveTessellationTol). + - 2026/08/03 (1.93.0) - Style: obsoleted `style.CurveTessellationTol` (default 1.25) which was in Pixels² unit in favor of `style.CurveTessellationMaxError` (default 1.12) which is in Pixels unit. + - style.CurveTessellationMaxError == sqrtf(style.CurveTessellationTol). - 2026/07/20 (1.92.9) - DragXXX, SliderXXX, InputScalar: with `ImGuiItemFlags_LiveEditOnInputScalar` now defaulting to being disabled: inputting a value with the keyboard doesn't write intermediate values to backing variable. (#9476) - Before: DragFloat() with user typing "123" --> write back 1, then 12, then 123. diff --git a/imgui.h b/imgui.h index acce04d3f..22a8b6da1 100644 --- a/imgui.h +++ b/imgui.h @@ -2560,9 +2560,10 @@ struct ImGuiIO bool ConfigDebugIgnoreFocusLoss; // = false // Ignore io.AddFocusEvent(false), consequently not calling io.ClearInputKeys()/io.ClearInputMouse() in input processing. // Option to compare < 1.93.0 rendering details vs 1.93.0 rendering details. (#9504) - // - Equivalent to calling PushDrawFlag(ImDrawList_StrokeLegacy,true) on every draw list instances. + // - Equivalent to calling PushDrawFlag(ImDrawFlags_StrokeLegacy,true) on every draw list instances. // - Suggested use, e.g. io.ConfigDebugDrawListDefaultsToStrokeLegacy = io.KeyShift; // Map to SHIFT modifier - bool ConfigDebugDrawListDefaultsToStrokeLegacy; // false // Default all ImDrawList to ImDrawList_StrokeLegacy mode, mimicking pre-1.93.0 rendering. + // - Also see our interactive testbed: https://www.dearimgui.com/docs/drawlist_v193 + bool ConfigDebugDrawListDefaultsToStrokeLegacy; // false // Default all ImDrawList to ImDrawFlags_StrokeLegacy mode, mimicking pre-1.93.0 rendering. //------------------------------------------------------------------ // Platform Identifiers From 906c6838ad97ebe87d61110593e28f29fdb211c2 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 12 Oct 2026 12:56:19 +0200 Subject: [PATCH 02/72] Debug: fixed DebugNodeTexture()->FormatTextureRefForDebugDisplay() truncating displayed value to 32-bits. (#9578) --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 5bf2ec239..76d1be2ac 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -16737,7 +16737,7 @@ static const char* FormatTextureRefForDebugDisplay(char* buf, int buf_size, ImTe char* buf_end = buf + buf_size; if (tex_ref._TexData != NULL) buf_p += ImFormatString(buf_p, buf_end - buf_p, "#%03d: ", tex_ref._TexData->UniqueID); - ImFormatString(buf_p, buf_end - buf_p, "0x%X", ImGui::DebugTextureIDToU64(tex_ref.GetTexID())); + ImFormatString(buf_p, buf_end - buf_p, "0x%" IM_PRIX64, ImGui::DebugTextureIDToU64(tex_ref.GetTexID())); return buf; } From dc09bbee1e0fe88caa20c352b8defea3c72d24bc Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Mon, 12 Oct 2026 13:11:36 +0200 Subject: [PATCH 03/72] Examples: GLFW/SDL2/SDL3+WebGPU: better select surface format instead of using surface_capabilities.formats[0]. (#9576) --- docs/CHANGELOG.txt | 1 + examples/example_glfw_wgpu/main.cpp | 16 ++++++++++++---- examples/example_sdl2_wgpu/main.cpp | 16 ++++++++++++---- examples/example_sdl3_wgpu/main.cpp | 16 ++++++++++++---- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 5d01ea9ad..070283aa0 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -435,6 +435,7 @@ Other Changes: - Examples: - MSVC: disabled /JMC in Visual Studio projects (unnecessary overhead). - GLFW/SDL2/SDL3+WebGPU: fixed running with wgpu-native missing `wgpuInstanceWaitAny()`. (#9377) + - GLFW/SDL2/SDL3+WebGPU: better select surface format. (#9576) [@ypujante] - GLFW+Metal: fixed mistakenly calling `ImGui_ImplGlfw_InitForOpenGL()`, which broke multi-viewport support. (#9564) [@ypujante] - SDL2+Metal: create Metal context without using a `SDL_Renderer`. diff --git a/examples/example_glfw_wgpu/main.cpp b/examples/example_glfw_wgpu/main.cpp index fe8b3de49..b84641b0d 100644 --- a/examples/example_glfw_wgpu/main.cpp +++ b/examples/example_glfw_wgpu/main.cpp @@ -290,6 +290,16 @@ int main(int, char**) return 0; } +static WGPUTextureFormat SelectSurfaceFormat(const WGPUSurfaceCapabilities& capabilities) +{ + const WGPUTextureFormat preferredFormats[] = { WGPUTextureFormat_BGRA8Unorm, WGPUTextureFormat_RGBA8Unorm, WGPUTextureFormat_BGRA8UnormSrgb, WGPUTextureFormat_RGBA8UnormSrgb }; + for (WGPUTextureFormat preferredFormat : preferredFormats) + for (size_t n = 0; n < capabilities.formatCount; n++) + if (capabilities.formats[n] == preferredFormat) + return preferredFormat; + return capabilities.formatCount > 0 ? capabilities.formats[0] : WGPUTextureFormat_Undefined; +} + #if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN) static WGPUAdapter RequestAdapter(wgpu::Instance& instance) { @@ -440,8 +450,7 @@ static bool InitWGPU(GLFWwindow* window) WGPUSurfaceCapabilities surface_capabilities = {}; wgpuSurfaceGetCapabilities(wgpu_surface, adapter.Get(), &surface_capabilities); - - preferred_fmt = surface_capabilities.formats[0]; + preferred_fmt = SelectSurfaceFormat(surface_capabilities); // WGPU backend: Adapter and Device acquisition, Surface creation #elif defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU) || defined(IMGUI_IMPL_WEBGPU_BACKEND_WGVK) @@ -470,8 +479,7 @@ static bool InitWGPU(GLFWwindow* window) WGPUSurfaceCapabilities surface_capabilities = {}; wgpuSurfaceGetCapabilities(wgpu_surface, adapter, &surface_capabilities); - - preferred_fmt = surface_capabilities.formats[0]; + preferred_fmt = SelectSurfaceFormat(surface_capabilities); #endif // IMGUI_IMPL_WEBGPU_BACKEND_WGPU wgpu_surface_configuration.presentMode = WGPUPresentMode_Fifo; diff --git a/examples/example_sdl2_wgpu/main.cpp b/examples/example_sdl2_wgpu/main.cpp index b0fa54179..9ed5b57c0 100644 --- a/examples/example_sdl2_wgpu/main.cpp +++ b/examples/example_sdl2_wgpu/main.cpp @@ -276,6 +276,16 @@ int main(int, char**) return 0; } +static WGPUTextureFormat SelectSurfaceFormat(const WGPUSurfaceCapabilities& capabilities) +{ + const WGPUTextureFormat preferredFormats[] = { WGPUTextureFormat_BGRA8Unorm, WGPUTextureFormat_RGBA8Unorm, WGPUTextureFormat_BGRA8UnormSrgb, WGPUTextureFormat_RGBA8UnormSrgb }; + for (WGPUTextureFormat preferredFormat : preferredFormats) + for (size_t n = 0; n < capabilities.formatCount; n++) + if (capabilities.formats[n] == preferredFormat) + return preferredFormat; + return capabilities.formatCount > 0 ? capabilities.formats[0] : WGPUTextureFormat_Undefined; +} + #if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN) static WGPUAdapter RequestAdapter(wgpu::Instance& instance) { @@ -427,8 +437,7 @@ static bool InitWGPU(SDL_Window* window) WGPUSurfaceCapabilities surface_capabilities = {}; wgpuSurfaceGetCapabilities(wgpu_surface, adapter.Get(), &surface_capabilities); - - preferred_fmt = surface_capabilities.formats[0]; + preferred_fmt = SelectSurfaceFormat(surface_capabilities); // WGPU backend: Adapter and Device acquisition, Surface creation #elif defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU) || defined(IMGUI_IMPL_WEBGPU_BACKEND_WGVK) @@ -457,8 +466,7 @@ static bool InitWGPU(SDL_Window* window) WGPUSurfaceCapabilities surface_capabilities = {}; wgpuSurfaceGetCapabilities(wgpu_surface, adapter, &surface_capabilities); - - preferred_fmt = surface_capabilities.formats[0]; + preferred_fmt = SelectSurfaceFormat(surface_capabilities); #endif // IMGUI_IMPL_WEBGPU_BACKEND_WGPU wgpu_surface_configuration.presentMode = WGPUPresentMode_Fifo; diff --git a/examples/example_sdl3_wgpu/main.cpp b/examples/example_sdl3_wgpu/main.cpp index c66748f80..8a61d69e3 100644 --- a/examples/example_sdl3_wgpu/main.cpp +++ b/examples/example_sdl3_wgpu/main.cpp @@ -287,6 +287,16 @@ int main(int, char**) return 0; } +static WGPUTextureFormat SelectSurfaceFormat(const WGPUSurfaceCapabilities& capabilities) +{ + const WGPUTextureFormat preferredFormats[] = { WGPUTextureFormat_BGRA8Unorm, WGPUTextureFormat_RGBA8Unorm, WGPUTextureFormat_BGRA8UnormSrgb, WGPUTextureFormat_RGBA8UnormSrgb }; + for (WGPUTextureFormat preferredFormat : preferredFormats) + for (size_t n = 0; n < capabilities.formatCount; n++) + if (capabilities.formats[n] == preferredFormat) + return preferredFormat; + return capabilities.formatCount > 0 ? capabilities.formats[0] : WGPUTextureFormat_Undefined; +} + #if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN) static WGPUAdapter RequestAdapter(wgpu::Instance& instance) { @@ -438,8 +448,7 @@ static bool InitWGPU(SDL_Window* window) WGPUSurfaceCapabilities surface_capabilities = {}; wgpuSurfaceGetCapabilities(wgpu_surface, adapter.Get(), &surface_capabilities); - - preferred_fmt = surface_capabilities.formats[0]; + preferred_fmt = SelectSurfaceFormat(surface_capabilities); // WGPU backend: Adapter and Device acquisition, Surface creation #elif defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU) || defined(IMGUI_IMPL_WEBGPU_BACKEND_WGVK) @@ -468,8 +477,7 @@ static bool InitWGPU(SDL_Window* window) WGPUSurfaceCapabilities surface_capabilities = {}; wgpuSurfaceGetCapabilities(wgpu_surface, adapter, &surface_capabilities); - - preferred_fmt = surface_capabilities.formats[0]; + preferred_fmt = SelectSurfaceFormat(surface_capabilities); #endif // IMGUI_IMPL_WEBGPU_BACKEND_WGPU wgpu_surface_configuration.presentMode = WGPUPresentMode_Fifo; From 6aa6626f29227dd4b998c458cee52e41ba7fdf83 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Wed, 7 Oct 2026 20:48:27 +0200 Subject: [PATCH 04/72] DrawList: improved handling of very small circles. See testbed case 354. --- imgui_draw.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 83ceaddc0..163022f1b 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2761,13 +2761,14 @@ void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col, if ((col & IM_COL32_A_MASK) == 0) return; - const float diameter = radius * 2.0f; - if (diameter < _FringeScale) IM_UNLIKELY + // Minimum radius, before the edge-AA will overlap. + const float min_radius = _FringeScale * 1.41421356f * 0.5f; + if (radius < min_radius) IM_UNLIKELY { - if (diameter < (1.0f / 255.0f) * _FringeScale) + if (radius < (1.0f / 255.0f) * min_radius) return; - col = ImAlphaMultiply(col, diameter * _InvFringeScale); - radius = _FringeScale * 0.5f; + col = ImAlphaMultiply(col, radius / min_radius); + radius = min_radius; } if (num_segments <= 0 && radius <= _Data->ArcFastRadiusCutoff) From 42a22377a4d0ba92a7155c7bc961bf85acbe24b3 Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Mon, 12 Oct 2026 23:07:30 +0200 Subject: [PATCH 05/72] Demo: Mixed Values: added IMGUI_DEMO_MARKER(). (#9582) --- imgui_demo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 97038f1e0..25a8a1429 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -2062,6 +2062,7 @@ static void DemoWindowWidgetsMixedValues() { if (ImGui::TreeNode("Mixed Values")) { + IMGUI_DEMO_MARKER("Widgets/Mixed Values"); // This is designed for advanced property editors which are generally reusable and data-driven. HelpMarker("Using ImGuiItemFlags_MixedValue."); From 09cd4416e85c0ccbe882e9e7c860e1b324cc4d71 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 13 Oct 2026 16:20:43 +0200 Subject: [PATCH 06/72] PlotHistogram: fixed passing inverted coordinates to AddRectFilled(). --- imgui_widgets.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 287d94062..00129d7c5 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -9144,7 +9144,7 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count); const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) * inv_scale) ); - // NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU. + // We could render lower-level to save a bit of CPU. ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0); ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t)); if (plot_type == ImGuiPlotType_Lines) @@ -9155,6 +9155,8 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get { if (pos1.x >= pos0.x + 2.0f) pos1.x -= 1.0f; + if (pos0.y > pos1.y) + ImSwap(pos0.y, pos1.y); window->DrawList->AddRectFilled(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base); } From 098c71133c32b7b946ae2b6db27fc8a4d0629d68 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 13 Oct 2026 16:14:30 +0200 Subject: [PATCH 07/72] Demo: Plot, Vertical Sliders, Colors: better scaling. + enforce some rounding in vertical slider demo. --- imgui_demo.cpp | 64 +++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 25a8a1429..66ab70299 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1261,6 +1261,7 @@ static void DemoWindowWidgetsColorAndPickers() ImGui::OpenPopup("mypicker"); backup_color = color; } + float ref_sz = ImGui::GetFrameHeight(); if (ImGui::BeginPopup("mypicker")) { ImGui::Text("MY CUSTOM COLOR PICKER WITH AN AMAZING PALETTE!"); @@ -1268,11 +1269,12 @@ static void DemoWindowWidgetsColorAndPickers() ImGui::ColorPicker4("##picker", (float*)&color, base_flags | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoSmallPreview); ImGui::SameLine(); + ImVec2 color_button_sz(ref_sz * 3.0f, ref_sz * 2.0f); ImGui::BeginGroup(); // Lock X position ImGui::Text("Current"); - ImGui::ColorButton("##current", color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60, 40)); + ImGui::ColorButton("##current", color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, color_button_sz); ImGui::Text("Previous"); - if (ImGui::ColorButton("##previous", backup_color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60, 40))) + if (ImGui::ColorButton("##previous", backup_color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, color_button_sz)) color = backup_color; ImGui::Separator(); ImGui::Text("Palette"); @@ -1283,7 +1285,7 @@ static void DemoWindowWidgetsColorAndPickers() ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.y); ImGuiColorEditFlags palette_button_flags = ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_NoTooltip; - if (ImGui::ColorButton("##palette", saved_palette[n], palette_button_flags, ImVec2(20, 20))) + if (ImGui::ColorButton("##palette", saved_palette[n], palette_button_flags)) color = ImVec4(saved_palette[n].x, saved_palette[n].y, saved_palette[n].z, color.w); // Preserve alpha! // Allow user to drop colors into each palette entry. Note that ColorButton() is already a @@ -1306,8 +1308,9 @@ static void DemoWindowWidgetsColorAndPickers() IMGUI_DEMO_MARKER("Widgets/Color/ColorButton (simple)"); ImGui::Text("Color button only:"); static bool no_border = false; + const ImVec2 color_button_sz(ref_sz * 2.0f, ref_sz * 2.0f); ImGui::Checkbox("ImGuiColorEditFlags_NoBorder", &no_border); - ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, base_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), ImVec2(80, 80)); + ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, base_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), color_button_sz); IMGUI_DEMO_MARKER("Widgets/Color/ColorPicker"); ImGui::SeparatorText("Color picker"); @@ -1682,12 +1685,13 @@ static void DemoWindowWidgetsDragAndDrop() "Brianna", "Barry", "Bernard", "Bibi", "Blaine", "Bryn" }; + float sz = ImGui::GetFrameHeight() * 3.0f; for (int n = 0; n < IM_COUNTOF(names); n++) { ImGui::PushID(n); if ((n % 3) != 0) ImGui::SameLine(); - ImGui::Button(names[n], ImVec2(60, 60)); + ImGui::Button(names[n], ImVec2(sz, sz)); // Our buttons are both drag sources and drag targets here! if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)) @@ -2183,10 +2187,12 @@ static void DemoWindowWidgetsPlotting() static bool animate = true; ImGui::Checkbox("Animate", &animate); + ImVec2 plot_sz(0.0f, ImGui::GetFrameHeight() * 4.0f); + // Plot as lines and plot as histogram static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; ImGui::PlotLines("Frame Times", arr, IM_COUNTOF(arr)); - ImGui::PlotHistogram("Histogram", arr, IM_COUNTOF(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f)); + ImGui::PlotHistogram("Histogram", arr, IM_COUNTOF(arr), 0, NULL, 0.0f, 1.0f, plot_sz); //ImGui::SameLine(); HelpMarker("Consider using ImPlot instead!"); // Fill an array of contiguous float values to plot @@ -2215,7 +2221,7 @@ static void DemoWindowWidgetsPlotting() average /= (float)IM_COUNTOF(values); char overlay[32]; sprintf(overlay, "avg %f", average); - ImGui::PlotLines("Lines", values, IM_COUNTOF(values), values_offset, overlay, -1.0f, 1.0f, ImVec2(0, 80.0f)); + ImGui::PlotLines("Lines", values, IM_COUNTOF(values), values_offset, overlay, -1.0f, 1.0f, plot_sz); } // Use functions to generate output @@ -2233,8 +2239,8 @@ static void DemoWindowWidgetsPlotting() ImGui::SameLine(); ImGui::SliderInt("Sample count", &display_count, 1, 400); float (*func)(void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw; - ImGui::PlotLines("Lines##2", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80)); - ImGui::PlotHistogram("Histogram##2", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80)); + ImGui::PlotLines("Lines##2", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, plot_sz); + ImGui::PlotHistogram("Histogram##2", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, plot_sz); ImGui::TreePop(); } @@ -4493,27 +4499,34 @@ static void DemoWindowWidgetsVerticalSliders() if (ImGui::TreeNode("Vertical Sliders")) { IMGUI_DEMO_MARKER("Widgets/Vertical Sliders"); - const float spacing = 4; - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(spacing, spacing)); + + ImGuiStyle& style = ImGui::GetStyle(); + ImVec2 slider_sz(ImGui::GetFrameHeight(), ImGui::GetFrameHeight() * 9); + + ImGui::PushStyleVarX(ImGuiStyleVar_ItemSpacing, (float)(int)(style.ItemSpacing.x * 0.5f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, (float)(int)(slider_sz.x * 0.25f)); + ImGui::PushStyleVar(ImGuiStyleVar_GrabRounding, (float)(int)(slider_sz.x * 0.25f)); + float spacing = style.ItemSpacing.x; static int int_value = 0; - ImGui::VSliderInt("##int", ImVec2(18, 160), &int_value, 0, 5); + ImGui::VSliderInt("##int", slider_sz, &int_value, 0, 5); ImGui::SameLine(); static float values[7] = { 0.0f, 0.60f, 0.35f, 0.9f, 0.70f, 0.20f, 0.0f }; ImGui::PushID("set1"); for (int i = 0; i < 7; i++) { - if (i > 0) ImGui::SameLine(); + if (i > 0)ImGui::SameLine(); ImGui::PushID(i); ImGui::PushStyleColor(ImGuiCol_FrameBg, (ImVec4)ImColor::HSV(i / 7.0f, 0.5f, 0.5f)); ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.5f)); ImGui::PushStyleColor(ImGuiCol_FrameBgActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.5f)); - ImGui::PushStyleColor(ImGuiCol_SliderGrab, (ImVec4)ImColor::HSV(i / 7.0f, 0.9f, 0.9f)); - ImGui::VSliderFloat("##v", ImVec2(18, 160), &values[i], 0.0f, 1.0f, ""); + ImGui::PushStyleColor(ImGuiCol_SliderGrab, (ImVec4)ImColor::HSV(i / 7.0f, 0.8f, 0.7f)); + ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.9f, 0.9f)); + ImGui::VSliderFloat("##v", slider_sz, &values[i], 0.0f, 1.0f, ""); if (ImGui::IsItemActive() || ImGui::IsItemHovered()) ImGui::SetTooltip("%.3f", values[i]); - ImGui::PopStyleColor(4); + ImGui::PopStyleColor(5); ImGui::PopID(); } ImGui::PopID(); @@ -4522,15 +4535,15 @@ static void DemoWindowWidgetsVerticalSliders() ImGui::PushID("set2"); static float values2[4] = { 0.20f, 0.80f, 0.40f, 0.25f }; const int rows = 3; - const ImVec2 small_slider_size(18, (float)(int)((160.0f - (rows - 1) * spacing) / rows)); + const ImVec2 slider_size_small(slider_sz.x, (float)(int)((slider_sz.y - (rows - 1) * spacing) / rows)); for (int nx = 0; nx < 4; nx++) { - if (nx > 0) ImGui::SameLine(); + if (nx > 0)ImGui::SameLine(); ImGui::BeginGroup(); for (int ny = 0; ny < rows; ny++) { ImGui::PushID(nx * rows + ny); - ImGui::VSliderFloat("##v", small_slider_size, &values2[nx], 0.0f, 1.0f, ""); + ImGui::VSliderFloat("##v", slider_size_small, &values2[nx], 0.0f, 1.0f, ""); if (ImGui::IsItemActive() || ImGui::IsItemHovered()) ImGui::SetTooltip("%.3f", values2[nx]); ImGui::PopID(); @@ -4543,15 +4556,17 @@ static void DemoWindowWidgetsVerticalSliders() ImGui::PushID("set3"); for (int i = 0; i < 4; i++) { - if (i > 0) ImGui::SameLine(); + if (i > 0) + ImGui::SameLine(); ImGui::PushID(i); - ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40); - ImGui::VSliderFloat("##v", ImVec2(40, 160), &values[i], 0.0f, 1.0f, "%.2f\nsec"); + ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, slider_sz.y * 0.25f); + ImGui::VSliderFloat("##v", ImVec2(slider_sz.x * 2.0f, slider_sz.y), &values[i], 0.0f, 1.0f, "%.2f\nsec"); ImGui::PopStyleVar(); ImGui::PopID(); } ImGui::PopID(); - ImGui::PopStyleVar(); + + ImGui::PopStyleVar(3); ImGui::TreePop(); } } @@ -8164,7 +8179,8 @@ static void DemoWindowInputs() ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15); ImGui::SliderInt("SetNextFrameWantCaptureKeyboard() on hover", &capture_override_keyboard, -1, +1, capture_override_desc[capture_override_keyboard + 1], ImGuiSliderFlags_AlwaysClamp); - ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(128.0f, 96.0f)); // Dummy item + float ref_sz = ImGui::GetFrameHeight() * 4.0f; + ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(ref_sz, ref_sz)); // Dummy item if (ImGui::IsItemHovered() && capture_override_mouse != -1) ImGui::SetNextFrameWantCaptureMouse(capture_override_mouse == 1); if (ImGui::IsItemHovered() && capture_override_keyboard != -1) From a536894821ce7358ebab622ac8a357ad4f9a93f3 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 13 Oct 2026 18:07:54 +0200 Subject: [PATCH 08/72] Examples: all examples now default to use a little bit of rounding (`FrameRounding` and `GrabRounding`). --- docs/CHANGELOG.txt | 1 + examples/example_allegro5/main.cpp | 7 +++++-- examples/example_android_opengl3/main.cpp | 8 +++++--- examples/example_apple_metal/main.mm | 7 +++++-- examples/example_apple_metal4/main.mm | 7 +++++-- examples/example_apple_opengl2/main.mm | 7 +++++-- examples/example_apple_opengl3/main.mm | 7 +++++-- examples/example_glfw_metal/main.mm | 8 +++++--- examples/example_glfw_opengl2/main.cpp | 8 +++++--- examples/example_glfw_opengl3/main.cpp | 8 +++++--- examples/example_glfw_vulkan/main.cpp | 8 +++++--- examples/example_glfw_wgpu/main.cpp | 8 +++++--- examples/example_glut_opengl2/main.cpp | 7 +++++-- examples/example_null/main.cpp | 8 ++++++++ examples/example_qnx_opengl3/main.cpp | 8 +++++--- examples/example_qnx_vulkan/main.cpp | 8 +++++--- examples/example_sdl2_directx11/main.cpp | 8 +++++--- examples/example_sdl2_metal/main.mm | 8 +++++--- examples/example_sdl2_opengl2/main.cpp | 8 +++++--- examples/example_sdl2_opengl3/main.cpp | 8 +++++--- examples/example_sdl2_sdlrenderer2/main.cpp | 8 +++++--- examples/example_sdl2_vulkan/main.cpp | 8 +++++--- examples/example_sdl2_wgpu/main.cpp | 8 +++++--- examples/example_sdl3_directx11/main.cpp | 8 +++++--- examples/example_sdl3_metal/main.mm | 8 +++++--- examples/example_sdl3_metal4/main.mm | 8 +++++--- examples/example_sdl3_opengl3/main.cpp | 8 +++++--- examples/example_sdl3_sdlgpu3/main.cpp | 8 +++++--- examples/example_sdl3_sdlrenderer3/main.cpp | 8 +++++--- examples/example_sdl3_vulkan/main.cpp | 8 +++++--- examples/example_sdl3_wgpu/main.cpp | 8 +++++--- examples/example_win32_directx10/main.cpp | 8 +++++--- examples/example_win32_directx11/main.cpp | 8 +++++--- examples/example_win32_directx12/main.cpp | 8 +++++--- examples/example_win32_directx9/main.cpp | 8 +++++--- examples/example_win32_opengl3/main.cpp | 10 ++++++---- examples/example_win32_vulkan/main.cpp | 8 +++++--- 37 files changed, 185 insertions(+), 100 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 070283aa0..3f70c1583 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -433,6 +433,7 @@ Other Changes: when `FramebufferScale` is >1.0f. (#9515, #8628) [@WayU] - WebGPU: update to build with wgpu-native 29.0+. (#9377, #9532, #9530) [@lucascompython, @ivan-enzhaev] - Examples: + - All: all examples now default to use a little bit of rounding (`FrameRounding` and `GrabRounding`). - MSVC: disabled /JMC in Visual Studio projects (unnecessary overhead). - GLFW/SDL2/SDL3+WebGPU: fixed running with wgpu-native missing `wgpuInstanceWaitAny()`. (#9377) - GLFW/SDL2/SDL3+WebGPU: better select surface format. (#9576) [@ypujante] diff --git a/examples/example_allegro5/main.cpp b/examples/example_allegro5/main.cpp index ebb6d76b0..577f09911 100644 --- a/examples/example_allegro5/main.cpp +++ b/examples/example_allegro5/main.cpp @@ -42,21 +42,24 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup Platform/Renderer backends ImGui_ImplAllegro5_Init(display); // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_android_opengl3/main.cpp b/examples/example_android_opengl3/main.cpp index 382006fa0..edd654feb 100644 --- a/examples/example_android_opengl3/main.cpp +++ b/examples/example_android_opengl3/main.cpp @@ -144,8 +144,12 @@ void Init(struct android_app* app) io.IniFilename = g_IniFilename.c_str();; // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup Platform/Renderer backends ImGui_ImplAndroid_Init(g_App->window); @@ -153,20 +157,18 @@ void Init(struct android_app* app) // Setup scaling float main_scale = 2.0f; - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! // - Android: The TTF files have to be placed into the assets/ directory (android/app/src/main/assets), we use our GetAssetData() helper to retrieve them. - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); diff --git a/examples/example_apple_metal/main.mm b/examples/example_apple_metal/main.mm index b8edbd2d1..cddc1093c 100644 --- a/examples/example_apple_metal/main.mm +++ b/examples/example_apple_metal/main.mm @@ -62,21 +62,24 @@ io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup Renderer backend ImGui_ImplMetal_Init(_device); // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_apple_metal4/main.mm b/examples/example_apple_metal4/main.mm index 1102e41f8..553eeb34c 100644 --- a/examples/example_apple_metal4/main.mm +++ b/examples/example_apple_metal4/main.mm @@ -66,8 +66,12 @@ io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // When viewports are enabled we tweak WindowRounding/WindowBg so platform windows can look identical to regular ones. @@ -76,13 +80,12 @@ // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_apple_opengl2/main.mm b/examples/example_apple_opengl2/main.mm index 7cdc38f20..67b546ead 100644 --- a/examples/example_apple_opengl2/main.mm +++ b/examples/example_apple_opengl2/main.mm @@ -50,8 +50,12 @@ io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup Platform/Renderer backends ImGui_ImplOSX_Init(self); @@ -59,13 +63,12 @@ // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_apple_opengl3/main.mm b/examples/example_apple_opengl3/main.mm index 241aa1332..7cb2e2a33 100644 --- a/examples/example_apple_opengl3/main.mm +++ b/examples/example_apple_opengl3/main.mm @@ -49,8 +49,12 @@ io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup Platform/Renderer backends [[self openGLContext] makeCurrentContext]; // ImGui_ImplOpenGL3_Init() requires a current GL context. @@ -59,13 +63,12 @@ // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_glfw_metal/main.mm b/examples/example_glfw_metal/main.mm index a3671e4e6..d398adc6b 100644 --- a/examples/example_glfw_metal/main.mm +++ b/examples/example_glfw_metal/main.mm @@ -46,11 +46,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -63,13 +66,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_glfw_opengl2/main.cpp b/examples/example_glfw_opengl2/main.cpp index 48584eaf8..454849c5e 100644 --- a/examples/example_glfw_opengl2/main.cpp +++ b/examples/example_glfw_opengl2/main.cpp @@ -55,11 +55,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -69,13 +72,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp index fbcc3e595..5abf4654d 100644 --- a/examples/example_glfw_opengl3/main.cpp +++ b/examples/example_glfw_opengl3/main.cpp @@ -83,11 +83,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -100,14 +103,13 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! // - Our Emscripten build process allows embedding fonts to be accessible at runtime from the "fonts/" folder. See Makefile.emscripten for details. - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_glfw_vulkan/main.cpp b/examples/example_glfw_vulkan/main.cpp index f2139cef7..e5f4d7560 100644 --- a/examples/example_glfw_vulkan/main.cpp +++ b/examples/example_glfw_vulkan/main.cpp @@ -392,11 +392,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -422,13 +425,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_glfw_wgpu/main.cpp b/examples/example_glfw_wgpu/main.cpp index b84641b0d..441da4a4a 100644 --- a/examples/example_glfw_wgpu/main.cpp +++ b/examples/example_glfw_wgpu/main.cpp @@ -89,11 +89,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -111,14 +114,13 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! // - Our Emscripten build process allows embedding fonts to be accessible at runtime from the "fonts/" folder. See Makefile.emscripten for details. - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); #ifndef IMGUI_DISABLE_FILE_FUNCTIONS diff --git a/examples/example_glut_opengl2/main.cpp b/examples/example_glut_opengl2/main.cpp index ca8017f5b..227dad48a 100644 --- a/examples/example_glut_opengl2/main.cpp +++ b/examples/example_glut_opengl2/main.cpp @@ -63,8 +63,12 @@ int main(int argc, char** argv) io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup Platform/Renderer backends // FIXME: Consider reworking this example to install our own GLUT funcs + forward calls ImGui_ImplGLUT_XXX ones, instead of using ImGui_ImplGLUT_InstallFuncs(). @@ -80,13 +84,12 @@ int main(int argc, char** argv) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_null/main.cpp b/examples/example_null/main.cpp index eba675670..ee6319fdc 100644 --- a/examples/example_null/main.cpp +++ b/examples/example_null/main.cpp @@ -16,6 +16,14 @@ int main(int, char**) ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); + // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); + ImGui::StyleColorsDark(); + //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; + ImGui_ImplNullPlatform_Init(); ImGui_ImplNullRender_Init(); diff --git a/examples/example_qnx_opengl3/main.cpp b/examples/example_qnx_opengl3/main.cpp index d78bee90c..f7f3f4ac7 100644 --- a/examples/example_qnx_opengl3/main.cpp +++ b/examples/example_qnx_opengl3/main.cpp @@ -63,11 +63,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -77,13 +80,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_qnx_vulkan/main.cpp b/examples/example_qnx_vulkan/main.cpp index ae309ad15..1d596d72e 100644 --- a/examples/example_qnx_vulkan/main.cpp +++ b/examples/example_qnx_vulkan/main.cpp @@ -471,11 +471,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -501,13 +504,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl2_directx11/main.cpp b/examples/example_sdl2_directx11/main.cpp index cf3971646..c5bbc3baf 100644 --- a/examples/example_sdl2_directx11/main.cpp +++ b/examples/example_sdl2_directx11/main.cpp @@ -77,11 +77,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -91,13 +94,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl2_metal/main.mm b/examples/example_sdl2_metal/main.mm index edd436aca..344310a3d 100644 --- a/examples/example_sdl2_metal/main.mm +++ b/examples/example_sdl2_metal/main.mm @@ -68,11 +68,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -82,13 +85,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl2_opengl2/main.cpp b/examples/example_sdl2_opengl2/main.cpp index 3b3412b14..081874aaa 100644 --- a/examples/example_sdl2_opengl2/main.cpp +++ b/examples/example_sdl2_opengl2/main.cpp @@ -66,11 +66,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -80,13 +83,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl2_opengl3/main.cpp b/examples/example_sdl2_opengl3/main.cpp index e7b101087..c1bc268fa 100644 --- a/examples/example_sdl2_opengl3/main.cpp +++ b/examples/example_sdl2_opengl3/main.cpp @@ -103,11 +103,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -117,14 +120,13 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! // - Our Emscripten build process allows embedding fonts to be accessible at runtime from the "fonts/" folder. See Makefile.emscripten for details. - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl2_sdlrenderer2/main.cpp b/examples/example_sdl2_sdlrenderer2/main.cpp index b69867354..9916dd85d 100644 --- a/examples/example_sdl2_sdlrenderer2/main.cpp +++ b/examples/example_sdl2_sdlrenderer2/main.cpp @@ -68,11 +68,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -82,13 +85,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl2_vulkan/main.cpp b/examples/example_sdl2_vulkan/main.cpp index 45a5a6de5..7c9af9eef 100644 --- a/examples/example_sdl2_vulkan/main.cpp +++ b/examples/example_sdl2_vulkan/main.cpp @@ -398,11 +398,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -428,13 +431,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl2_wgpu/main.cpp b/examples/example_sdl2_wgpu/main.cpp index 9ed5b57c0..abc7be29c 100644 --- a/examples/example_sdl2_wgpu/main.cpp +++ b/examples/example_sdl2_wgpu/main.cpp @@ -74,11 +74,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -93,14 +96,13 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! // - Our Emscripten build process allows embedding fonts to be accessible at runtime from the "fonts/" folder. See Makefile.emscripten for details. - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); #ifndef IMGUI_DISABLE_FILE_FUNCTIONS diff --git a/examples/example_sdl3_directx11/main.cpp b/examples/example_sdl3_directx11/main.cpp index 4337d4e2d..8b28d1302 100644 --- a/examples/example_sdl3_directx11/main.cpp +++ b/examples/example_sdl3_directx11/main.cpp @@ -68,11 +68,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -82,13 +85,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl3_metal/main.mm b/examples/example_sdl3_metal/main.mm index e6e306624..8edd50c09 100644 --- a/examples/example_sdl3_metal/main.mm +++ b/examples/example_sdl3_metal/main.mm @@ -64,11 +64,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -78,13 +81,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl3_metal4/main.mm b/examples/example_sdl3_metal4/main.mm index 6debb5133..b2807935f 100644 --- a/examples/example_sdl3_metal4/main.mm +++ b/examples/example_sdl3_metal4/main.mm @@ -80,11 +80,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -94,13 +97,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl3_opengl3/main.cpp b/examples/example_sdl3_opengl3/main.cpp index e7d22a40c..819d9bd1c 100644 --- a/examples/example_sdl3_opengl3/main.cpp +++ b/examples/example_sdl3_opengl3/main.cpp @@ -93,11 +93,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -107,14 +110,13 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! // - Our Emscripten build process allows embedding fonts to be accessible at runtime from the "fonts/" folder. See Makefile.emscripten for details. - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl3_sdlgpu3/main.cpp b/examples/example_sdl3_sdlgpu3/main.cpp index 8edbbbbad..6caa71c1a 100644 --- a/examples/example_sdl3_sdlgpu3/main.cpp +++ b/examples/example_sdl3_sdlgpu3/main.cpp @@ -70,11 +70,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -90,13 +93,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl3_sdlrenderer3/main.cpp b/examples/example_sdl3_sdlrenderer3/main.cpp index 88f9ac7fb..8fbd6a972 100644 --- a/examples/example_sdl3_sdlrenderer3/main.cpp +++ b/examples/example_sdl3_sdlrenderer3/main.cpp @@ -58,11 +58,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -72,13 +75,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl3_vulkan/main.cpp b/examples/example_sdl3_vulkan/main.cpp index 0073b37c5..b0474e635 100644 --- a/examples/example_sdl3_vulkan/main.cpp +++ b/examples/example_sdl3_vulkan/main.cpp @@ -397,11 +397,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -427,13 +430,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_sdl3_wgpu/main.cpp b/examples/example_sdl3_wgpu/main.cpp index 8a61d69e3..42053f0fb 100644 --- a/examples/example_sdl3_wgpu/main.cpp +++ b/examples/example_sdl3_wgpu/main.cpp @@ -81,11 +81,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -101,14 +104,13 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! // - Our Emscripten build process allows embedding fonts to be accessible at runtime from the "fonts/" folder. See Makefile.emscripten for details. - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); #ifndef IMGUI_DISABLE_FILE_FUNCTIONS diff --git a/examples/example_win32_directx10/main.cpp b/examples/example_win32_directx10/main.cpp index 2c3420709..b68ba06fe 100644 --- a/examples/example_win32_directx10/main.cpp +++ b/examples/example_win32_directx10/main.cpp @@ -59,11 +59,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -73,13 +76,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_win32_directx11/main.cpp b/examples/example_win32_directx11/main.cpp index 524538ac1..5f3af383f 100644 --- a/examples/example_win32_directx11/main.cpp +++ b/examples/example_win32_directx11/main.cpp @@ -59,11 +59,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -73,13 +76,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_win32_directx12/main.cpp b/examples/example_win32_directx12/main.cpp index 0d8bb20b1..5fb0ed788 100644 --- a/examples/example_win32_directx12/main.cpp +++ b/examples/example_win32_directx12/main.cpp @@ -139,11 +139,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -168,13 +171,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_win32_directx9/main.cpp b/examples/example_win32_directx9/main.cpp index fbe4c3983..f0711698e 100644 --- a/examples/example_win32_directx9/main.cpp +++ b/examples/example_win32_directx9/main.cpp @@ -57,11 +57,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -71,13 +74,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_win32_opengl3/main.cpp b/examples/example_win32_opengl3/main.cpp index cba8301f8..28c92a677 100644 --- a/examples/example_win32_opengl3/main.cpp +++ b/examples/example_win32_opengl3/main.cpp @@ -68,11 +68,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); - //ImGui::StyleColorsClassic(); + //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -82,13 +85,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); diff --git a/examples/example_win32_vulkan/main.cpp b/examples/example_win32_vulkan/main.cpp index cbdbdb830..4c66a5422 100644 --- a/examples/example_win32_vulkan/main.cpp +++ b/examples/example_win32_vulkan/main.cpp @@ -385,11 +385,14 @@ int main(int, char**) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style + ImGuiStyle& style = ImGui::GetStyle(); ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); + //style.FontSizeBase = 16.0f; // Default to 13.0f when unspecified, which allows crisp legacy font for non-4K screens. + style.FrameRounding = 3.0f; + style.GrabRounding = 3.0f; // Setup scaling - ImGuiStyle& style = ImGui::GetStyle(); style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again) style.FontScaleDpi = main_scale; // Set initial font scale. (in docking branch: using io.ConfigDpiScaleFonts=true automatically overrides this for every window depending on the current monitor) @@ -415,13 +418,12 @@ int main(int, char**) // Load Fonts // - If fonts are not explicitly loaded, Dear ImGui will select an embedded font: either AddFontDefaultVector() or AddFontDefaultBitmap(). - // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a small threshold. + // This selection is based on (style.FontSizeBase * style.FontScaleMain * style.FontScaleDpi) reaching a threshold. // - You can load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - If a file cannot be loaded, AddFont functions will return a nullptr. Please handle those errors in your code (e.g. use an assertion, display an error and quit). // - Read 'docs/FONTS.md' for more instructions and details. // - Use '#define IMGUI_ENABLE_FREETYPE' in your imconfig file to use FreeType for higher quality font rendering. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! - //style.FontSizeBase = 20.0f; //io.Fonts->AddFontDefaultVector(); //io.Fonts->AddFontDefaultBitmap(); //io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf"); From a6fad9bbda027c7a2a207ee67fb4791217fe5493 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 13 Oct 2026 18:05:27 +0200 Subject: [PATCH 09/72] Style: update StyleColorsDark() for 1.93: greyer WindowBg, dark FrameBg. --- docs/CHANGELOG.txt | 10 +++++++--- imgui_demo.cpp | 3 ++- imgui_draw.cpp | 16 ++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 3f70c1583..0ed9ea57f 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -193,6 +193,13 @@ Breaking Changes: Other Changes: +- Style: + - StyleColorsDark(): minor refresh of the default style to look more modern: + - Changed WindowBg to use a slightly greyer value and removed opacity. + - Changed FrameBg values to use a dark black to make frames stand out better. + - Tweak TextDisabled, TableHeaderBg, TableBorders to match altered WindowBg. + - StyleColorsLight(): inverted `ImGuiCol_TitleBgXXX` colors so that the selected + window title bar appears brighter. - DrawList: - Added flags to specify stroke position in all `ImDrawList` stroking functions: (#9504) [@memononen] - `ImDrawFlags_StrokeInside` (default for Rect, Circle/Ellipse, Triangle, Quad, Ngon + AddLineH, AddLineV) @@ -368,9 +375,6 @@ Other Changes: match always filters out. (#2435) [@kudaba, @ocornut] - Added `DrawWithHint()` function. (#6206, #6395, #6447) - Added a "incl -excl" hint by default when the search field is empty. (#6206, #6395, #6447) -- Style: - - Inverted `ImGuiCol_TitleBgXXX` colors for `StyleColorsLight()` so that the selected - window title bar appears brighter. - Misc: - Added `ImGuiItemFlags_MixedValue` flag for representing mixed/indeterminate values. Supported by: Checkbox(), RadioButton(), DragXXX(), SliderXXX(), InputXXX(), ColorXXX() diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 66ab70299..aa1b78509 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -965,8 +965,9 @@ static void DemoWindowWidgetsBasic() ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.6f)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.7f)); ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.8f, 0.8f)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f)); ImGui::Button("Click"); - ImGui::PopStyleColor(3); + ImGui::PopStyleColor(4); ImGui::PopID(); } diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 163022f1b..d33cff20d 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -190,15 +190,15 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst) ImVec4* colors = style->Colors; colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); - colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); - colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f); + colors[ImGuiCol_TextDisabled] = ImVec4(0.58f, 0.58f, 0.58f, 1.00f); + colors[ImGuiCol_WindowBg] = ImVec4(0.18f, 0.18f, 0.18f, 1.00f); colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f); colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); - colors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f); - colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); - colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); + colors[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); + colors[ImGuiCol_FrameBgHovered] = ImVec4(0.19f, 0.25f, 0.31f, 1.00f); + colors[ImGuiCol_FrameBgActive] = ImVec4(0.21f, 0.33f, 0.47f, 1.00f); colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f); colors[ImGuiCol_TitleBgActive] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f); colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f); @@ -235,9 +235,9 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst) colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); - colors[ImGuiCol_TableHeaderBg] = ImVec4(0.19f, 0.19f, 0.20f, 1.00f); - colors[ImGuiCol_TableBorderStrong] = ImVec4(0.31f, 0.31f, 0.35f, 1.00f); // Prefer using Alpha=1.0 here - colors[ImGuiCol_TableBorderLight] = ImVec4(0.23f, 0.23f, 0.25f, 1.00f); // Prefer using Alpha=1.0 here + colors[ImGuiCol_TableHeaderBg] = ImVec4(0.28f, 0.28f, 0.29f, 1.00f); + colors[ImGuiCol_TableBorderStrong] = ImVec4(0.40f, 0.40f, 0.45f, 1.00f); // Prefer using Alpha=1.0 here + colors[ImGuiCol_TableBorderLight] = ImVec4(0.32f, 0.32f, 0.34f, 1.00f); // Prefer using Alpha=1.0 here colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f); colors[ImGuiCol_TextLink] = colors[ImGuiCol_HeaderActive]; From c1aaac65e896a45f81f47a4d68f9959e0f86c859 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 14 Oct 2026 16:46:54 +0200 Subject: [PATCH 10/72] Version 1.93.0 --- docs/CHANGELOG.txt | 105 ++++++++++++++++++++++----------------------- imgui.cpp | 2 +- imgui.h | 8 ++-- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- imgui_internal.h | 2 +- imgui_tables.cpp | 2 +- imgui_widgets.cpp | 2 +- 8 files changed, 62 insertions(+), 63 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 0ed9ea57f..b5d983005 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -36,9 +36,11 @@ HOW TO UPDATE? - Please report any issue! ----------------------------------------------------------------------- - VERSION 1.93.0 WIP (In Progress) + VERSION 1.93.0 (Released 2026-10-14) ----------------------------------------------------------------------- +Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.93.0 + In 1.93.0, the `ImDrawList` rendering API has been improved to be more robust and more consistent over the whole range of shapes. The rendering now matches much closer to common vector drawing APIs, like html canvas. Improvements, like anti-aliased line @@ -55,10 +57,10 @@ The rendering of common shapes was optimized when the shapes fall on integer coo using textures instead of tessellated geometry to draw round corners. The varying code-paths are designed to look indistinguishable from each others. -New rendering code fixes some inconsistencies between graphics APIs (e.g. DirectX vs OpenGL) -which are using different diamond exits rules. -New code should work precisely the same regardless of graphics API. -(note that using _StrokeLegacy mode can lead to similar inconsistencies) +New rendering code fixes some inconsistencies between graphics APIs +(e.g. DirectX vs OpenGL) which are using different diamond exits rules. +New code should work precisely the same regardless of which graphics API is used +(note that using _StrokeLegacy mode can lead to the same old inconsistencies). New rendering code also deals better with animating thickness and rounding (integer values are recommended). @@ -73,31 +75,29 @@ Use `ImDrawFlags_StrokeLegacy` mode to emulate old rendering: - Globally: ImGui::Checkbox("DefaultsToStrokeLegacy", &io.ConfigDebugDrawListDefaultsToStrokeLegacy); // Map to a checkbox - Globally: io.ConfigDebugDrawListDefaultsToStrokeLegacy = io.KeyShift; // Map on Shift -Don't panic! Many applications will not notice any difference! You will more likely -see differences if you used lots of direct `ImDrawList` calls for custom rendering. +Don't panic! +Many applications will not notice any difference! You will more likely see +differences if you used lots of direct `ImDrawList` calls for custom rendering. -Main work courtesy of @memononen. -Additional work/reviewing/guidance by @ocornut. -With legacy bits from @thedmd, @potocpav. +Credits for ImDrawList changes in 1.93.0: +- main work courtesy of @memononen. +- additional work/reviewing/guidance by @ocornut. +- with legacy bits from @thedmd, @potocpav. +Other credits marked below, or @ocornut when omitted. Refer to our guides: - - ImDrawList Vector Rendering Reference https://github.com/ocornut/imgui/wiki/Draw-List (includes a precise list of differences between 1.92.9 and 1.93.0). - - ImDrawList 1.92.9 vs 1.93.0 Interactive Testbed https://www.dearimgui.com/docs/drawlist_v193 - (interactively discuss and compare differences between 1.92.9 and 1.93.0) + (interactively compare differences between 1.92.9 and 1.93.0 + commentary) (downloadable HTML file, may be used offline) - - Pixel Perfect Anti-aliased Rendering https://github.com/ocornut/imgui/wiki/Pixel-Perfect-Rendering - - How Anti-aliased Polyline Rendering is Implemented https://github.com/ocornut/imgui/wiki/Polyline-Rendering - -- Main topic: +- Discussion topic: https://github.com/ocornut/imgui/issues/9504 (if you have a problem to discuss, please open a new issue) @@ -124,8 +124,8 @@ Breaking Changes: - Your lines will appear offset by -0.5f pixels on each axis. Being anti-aliased diagonal lines, they won't look particularly better or worse, just slightly offset. It'll likely only be noticeable if you carefully combined them with other primitives for a pixel-perfect result. - - Old `AddLine({x1, y1}, {x2, y2}, col)` --> `AddLine({x1 + 0.5f, y1 + 0.5f}, {x2+ 0.5f, y2 + 0.5f}, col);` // Same - or use `ImDrawFlags_StrokeLegacy` --> `AddLine({x1, y1}, {x2, y2}, col, thickness, ImDrawFlags_StrokeLegacy); // Offset by +0.5f + disable AA ends. + - Old `AddLine({x1, y1}, {x2, y2}, col)` --> `AddLine({x1 + 0.5f, y1 + 0.5f}, {x2+ 0.5f, y2 + 0.5f}, col);` // Same + or use `ImDrawFlags_StrokeLegacy` --> `AddLine({x1, y1}, {x2, y2}, col, thickness, ImDrawFlags_StrokeLegacy);` // Offset by +0.5f + disable AA ends. This reapplies the old offset, and should get you exactly the same result you previously got for thickness=1.0f lines. But said result were previously sometimes ambiguous and renderer-dependent. (#3116, #3258, #2441) @@ -144,7 +144,7 @@ Breaking Changes: Previously, non-integer coordinates rendered with aliased edges snapped by the rasterizer. (#6971) - AddRect(), AddRectFilled(): rectangles with inverted coordinates won't be visible - unless using ImDrawFlags_StrokeLegacy mode. With inverted coordinates (min > max): + unless using `ImDrawFlags_StrokeLegacy` mode. With inverted coordinates (min > max): - Legacy `AddRect()` rounding off -> visible but incorrect outer size. - Legacy `AddRect()` rounding on -> visible but very glitchy. - Legacy `AddRectFilled()` rounding off -> visible and correct. @@ -188,8 +188,7 @@ Breaking Changes: for `ImGuiBackendFlags_RendererHasTextures`. Use the new signature! (#9487) - OpenGL3: Does not attempt to read `GL_CLIP_ORIGIN` by default as the detection is sub-optimal and not reliable on some setup. Use `ImGui_ImplOpenGL3_SetClipOrigin(0)` - to enable auto-detection, or e.g. `ImGui_ImplOpenGL3_SetClipOrigin(GL_UPPER_LEFT)`. - + to enable auto-detection, or e.g. `ImGui_ImplOpenGL3_SetClipOrigin(GL_UPPER_LEFT)`. Other Changes: @@ -200,7 +199,7 @@ Other Changes: - Tweak TextDisabled, TableHeaderBg, TableBorders to match altered WindowBg. - StyleColorsLight(): inverted `ImGuiCol_TitleBgXXX` colors so that the selected window title bar appears brighter. -- DrawList: +- ImDrawList: - Added flags to specify stroke position in all `ImDrawList` stroking functions: (#9504) [@memononen] - `ImDrawFlags_StrokeInside` (default for Rect, Circle/Ellipse, Triangle, Quad, Ngon + AddLineH, AddLineV) - `ImDrawFlags_StrokeCenter` (default for Line, Polyline, Beziers, Paths function) @@ -267,25 +266,25 @@ Other Changes: - AddConvexPolyFilled()/PathFillConvex(): improved to handle input geometry more robustly. The rendering of sharp corners was improved. Earlier there were issues with sharp corners either creating long spikes, or messing up the adjacent edge's anti-aliasing. Now the - anti-aliasing fringe calculation is more consistent, and sharp corners get bevelled to + anti-aliasing fringe calculation is more consistent, and sharp corners get beveled to avoid spikes. There might still be issues when the smallest extent of a long thin polygon is less than a pixel. Also supports `ImDrawFlags_JoinMiter`, to facilitate matching a stroke using the same flag. - - AddRect(), AddRectFilled(): various optimizations for rounded rectangles. (#1962, #9504) + - `AddRect()`, `AddRectFilled()`: various optimizations for rounded rectangles. (#1962, #9504) - Integer-aligned coordinates and thicknesses will automatically use baked textures, saving on both CPU and vertex/index data. - Enabled by default. Use `ImFontAtlasFlags_NoBakedRoundCorners` to disable baking round corners in font atlas. - Added `ImDrawFlags_UseTexForRoundCorners` flag to enable in scope or per-shape. Added for consistency and debugging, not really needed in practice. - - AddCircle, AddCircleFilled: fixed large circles being under-tessellated + - `AddCircle()`, `AddCircleFilled()`: fixed large circles being under-tessellated (when above ~140 with default CircleTessellationMaxError). - Improved debug-build performance in various locations. - Improved minor mismatches when overlapping strokes and filled shapes. For example, when using inside strokes, - `AddRect()` and `AddRectFilled()` with rounding now overlap better. (#3656) - `AddCircle()` and `AddCircleFilled()` now overlap better. - - Added ImDrawList::PushDrawFlag()/PopDrawFlag() to alter certain flags for a + - Added `ImDrawList::PushDrawFlag()`/`PopDrawFlag()` to alter certain flags for a scope and a given `ImDrawList`. (#9489) - e.g. `PushDrawFlag(ImDrawFlags_StrokeLegacy, true);` enforce legacy tweaks. - About `ImDrawFlags_StrokeLegacy`: @@ -308,21 +307,25 @@ Other Changes: - Many thick shapes had broken corners with old no-AA code, and the old no-AA code was wildly different from the AA code. Not the case any more. (#288) - Per-viewport FramebufferScale for Apple/Retina screen is applied to draw lists: - - AA Fringe is scaled accordingly. + - AA Fringe is scaled accordingly. (#9577) - Circle and Curves tessellation error are scaled accordingly. - - Reworked assert in PushTexture() to allow convenience grace period of using a + - Reworked assert in `PushTexture()` to allow convenience grace period of using a texture that was queue for destroy during the frame. Make it safe to stick to an existing texture during the frame. (#9528, #8465) - Added optional `platform_io.DrawCallback_SetSamplerFromTex` standard backend-agnostic draw callback for requesting to use the sampler associated already associated to a texture. Currently only supported by the OpenGL2/3 and SDLRenderer3 backend. (#9378) - - Fixed dangling ImDrawList::_OwnerName when using animated label. (#9552) [@ubi-dcastonguay] - + - Fixed dangling `ImDrawList::_OwnerName` when using animated label. (#9552) [@ubi-dcastonguay] +- Mixed Values: + - Added `ImGuiItemFlags_MixedValue` flag for representing mixed/indeterminate values. + Supported by: Checkbox(), RadioButton(), DragXXX(), SliderXXX(), InputXXX(), ColorXXX() + and Combo() functions. + The scoped flag is designed for usage by advanced property editors. (#5518, #5677, #6865) - Drags, Sliders: - - Fixed an overflow using `ImGuiSliderFlags_Logarithmic` with S32/S64 types which - leads to clamped interactions. (#9526, #3361, #1823, #1316, #642) [@lailoken] - Ongoing drags may be cancelled using Right-Click, Escape or Gamepad Triangle. Cancelling reverts to the initial value. (#8564, #9534) + - Fixed an overflow using `ImGuiSliderFlags_Logarithmic` with S32/S64 types which + leads to clamped interactions. (#9526, #3361, #1823, #1316, #642) [@lailoken] - TreeNode: - Fixed issues/asserts with 32+ deep trees when using ImGuiTreeNodeFlags_DrawLinesXXX features or other features requiring stack storage. (#9509) [@lasrod] @@ -331,14 +334,14 @@ Other Changes: section width. - Using <> scrolling buttons while the selected Tab is at either end of the section mid-section but not fully visible always makes it fully visible - (before eventually selecting a Tab in the leading/trailing section) + (before eventually selecting a Tab in the leading/trailing section). - Tables: - Fixed a bug restoring correct .ini columns order when table use is Sortable but had no user changes. (regression from 1.92.9). (#9519, #9108) - Fixed a bug tracking topology changes (insert new columns in the middle) when the table is not _Reorderable: new columns would be ordered incorrectly. (#9570, #9108, #9572) [@lailoken] -- InpuText: +- InputText: - Fixed a crash in some cases when using Home key in a WordWrap+ReadOnly field. (#9561) - Selectable: - Fixed `ImGuiSelectableFlags_SelectOnNav` triggering during NavInit. @@ -346,9 +349,9 @@ Other Changes: - Reworked `AddFontDefault()` to use `io.DisplayFrameBufferScale` as part of the heuristic to select `AddFontDefaultVector()` by default, effectively using ProggyForever instead of ProggyClean on most Apple/Retina setups by default. - - Added ImFont::AddRemapCodepointToGlyphIndex() allowing to access glyphs that are not + - Added `ImFont::AddRemapCodepointToGlyphIndex()` allowing to access glyphs that are not mapped to codepoints. (#9559, #5647, #609, #5748, #8466) - - imgui_freetype: Fixed blurryness rendering `AddFontDefaultVector()`. Caused by a + - imgui_freetype: Fixed blurriness rendering `AddFontDefaultVector()`. Caused by a non-pixel aligned offset caused by `ExtraSizeScale`. (#9348, #9233) [@redpartizan, @RDMCz] - (Internal) ImFontLoader: reworked `FontSrcContainsGlyph`, `FontBakedLoadGlyph` signatures to take raw glyph index instead of codepoint. Added `FontSrcGetGlyphIndexFromCodepoint`. @@ -356,7 +359,7 @@ Other Changes: - Added `IMGUI_DISABLE_STB_TRUETYPE` to completely omit the stb_truetype loader code + stb_truetype.h code. (#9573) - ColorEdit: - - ColorButton, ColorEdit, ColorPicker: cancel-out alpha caused by BeginDisabled() so + - ColorButton, ColorEdit, ColorPicker: cancel-out alpha caused by `BeginDisabled()` so disabled color buttons have the same color as non-disabled oness. (#9511) - ColorButton: fixed issues/inconsistencies with checkerboard rendering when combining color alpha and global style alpha. (#9511) [@enjmiah, @ocornut] @@ -375,13 +378,17 @@ Other Changes: match always filters out. (#2435) [@kudaba, @ocornut] - Added `DrawWithHint()` function. (#6206, #6395, #6447) - Added a "incl -excl" hint by default when the search field is empty. (#6206, #6395, #6447) +- Widgets: + - Checkbox, Menus: check marks use anti-aliased ends. + - Tweaked rendering in various locations to avoid blurriness: + - Windows: title-bar and menu-bar border (when thickness>1.0f). + - SeparatorText: border (when thickness>1.0f). + - Tree: hierarchy lines (when thickness>1.0f). + - InputText: input caret (when thickness>1.0f). + - TabBar: selected overline border (when thickness>1.0f). - Misc: - - Added `ImGuiItemFlags_MixedValue` flag for representing mixed/indeterminate values. - Supported by: Checkbox(), RadioButton(), DragXXX(), SliderXXX(), InputXXX(), ColorXXX() - and Combo() functions. - The scoped flag is designed for usage by advanced property editors. (#5518, #5677, #6865) - Fixed `GetBackgroundDrawList()`/`GetForegroundDrawList()` not being properly reset - every frame when cumulated session time is very large (e.g. a few days). [@lailoken] + every frame when accumulated session time is very large (e.g. a few days). [@lailoken] - Added `IM_NODEBUGSTEP` helper to tag functions with `__declspec(non_user_code)` (MSVC) or `[[gnu::artificial]]` (Clang/GCC) in order to provide a hint to debuggers to skip trivial functions when stepping into. @@ -390,16 +397,8 @@ Other Changes: - Fixed strict aliasing violation in `ImHashData()` affecting Clang 23 + SSE 4.2 + -flto. Could manifest as `ImFontAtlasBakedGetId()` computation omitting font size from the hashed data. (#9557, #9560) [@sthalik] - - IO: restore default clipboard/ime/shell platform handlers on ClearPlatformHandlers(), fixing + - IO: restore default clipboard/ime/shell platform handlers on `ClearPlatformHandlers()`, fixing issues switching backends mid-session to one relying on default. (#9537, #8945, #2769) [@lstalmir] -- Widgets: - - Checkbox, Menus: check marks use anti-aliased ends. - - Tweaked rendering in various locations to avoid blurryness: - - Windows: title-bar and menu-bar border (when thickness>1.0f). - - SeparatorText: border (when thickness>1.0f). - - Tree: hierarchy lines (when thickness>1.0f). - - InputText: input caret (when thickness>1.0f). - - TabBar: selected overline border (when thickness>1.0f). - Demo: - Added `Widgets->Mixed Values` section. (#5518, #5677, #6865) - Custom Rendering section: exposed new flags; showcasing overlapping strokes @@ -413,7 +412,7 @@ Other Changes: and leave the other ones untouched. (#9574) [@tqjxlm] - OpenGL2, OpenGL3: added support for `platform_io.DrawCallback_SetSamplerFromTex` draw callback to request using the sampler associated already associated to a texture. (#9378) - - OpenGL2, OpenGL3: fixed `DrawCallback_ResetRenderState` handler not reseting all states + - OpenGL2, OpenGL3: fixed `DrawCallback_ResetRenderState` handler not resetting all states in the glTexParameter() path. (#9378) - OpenGL3: added `ImGui_ImplOpenGL3_SetClipOrigin()` to specify origin between `GL_LOWER_LEFT` (new default), `GL_UPPER_LEFT` and `0` (autodetect, old default). diff --git a/imgui.cpp b/imgui.cpp index 76d1be2ac..3705e7262 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 WIP +// dear imgui, v1.93.0 // (main code and documentation) // Help: diff --git a/imgui.h b/imgui.h index 22a8b6da1..df2d42675 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 WIP +// dear imgui, v1.93.0 // (headers) // Help: @@ -29,8 +29,8 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') -#define IMGUI_VERSION "1.93.0 WIP" -#define IMGUI_VERSION_NUM 19298 +#define IMGUI_VERSION "1.93.0" +#define IMGUI_VERSION_NUM 19300 #define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000 #define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198 @@ -992,7 +992,7 @@ namespace ImGui IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDragDropTarget() returns true! IMGUI_API const ImGuiPayload* GetDragDropPayload(); // peek directly into the current payload from anywhere. returns NULL when drag and drop is finished or inactive. use ImGuiPayload::IsDataType() to test for the payload type. - // Disabling [BETA API] + // Disabling // - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors) // - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled) // - Tooltips windows are automatically opted out of disabling. Note that IsItemHovered() by default returns false on disabled items, unless using ImGuiHoveredFlags_AllowWhenDisabled. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index aa1b78509..13734d316 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 WIP +// dear imgui, v1.93.0 // (demo code) // Help: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index d33cff20d..0d54ee8ad 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 WIP +// dear imgui, v1.93.0 // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index 74d91a7d4..420f070e8 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 WIP +// dear imgui, v1.93.0 // (internal structures/api) // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility. diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 0391bf735..a1757ed3f 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 WIP +// dear imgui, v1.93.0 // (tables and columns code) /* diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 00129d7c5..821b15f44 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 WIP +// dear imgui, v1.93.0 // (widgets code) /* From 6d32174508fb8c518e7a832cc1d571fadd5cba76 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 14:03:51 +0200 Subject: [PATCH 11/72] Allow IM_NODEBUGSTEP to be defined by user. (#9584) Amend e2e9533991 --- imgui.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/imgui.h b/imgui.h index df2d42675..a7b071dab 100644 --- a/imgui.h +++ b/imgui.h @@ -130,6 +130,7 @@ Index of this file: // Alternative to using a .natstepfilter file or other scripts in misc/debuggers/ to skip debug-stepping selected trivial functions. // If you get a compiler error or warning related to use, please report it to us! +#ifndef IM_NODEBUGSTEP #if (defined(__clang__) && (__clang_major__ >= 7)) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) #define IM_NODEBUGSTEP [[gnu::artificial]] #elif defined(_MSC_VER) && (_MSC_VER >= 1915) @@ -137,6 +138,7 @@ Index of this file: #else #define IM_NODEBUGSTEP #endif +#endif // Warnings #ifdef _MSC_VER From f9961262498b3a2606fefb1ef23d02412f7bb582 Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Thu, 15 Oct 2026 14:28:13 +0200 Subject: [PATCH 12/72] Demo: correct demo markers wordings (#9586) --- imgui_demo.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 13734d316..1337d60ba 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1651,10 +1651,10 @@ static void DemoWindowWidgetsDragAndDrop() { if (ImGui::TreeNode("Drag and Drop")) { - IMGUI_DEMO_MARKER("Widgets/Drag and drop"); + IMGUI_DEMO_MARKER("Widgets/Drag and Drop"); if (ImGui::TreeNode("Drag and drop in standard widgets")) { - IMGUI_DEMO_MARKER("Widgets/Drag and drop/Standard widgets"); + IMGUI_DEMO_MARKER("Widgets/Drag and Drop/Standard widgets"); // ColorEdit widgets automatically act as drag source and drag target. // They are using standardized payload strings IMGUI_PAYLOAD_TYPE_COLOR_3F and IMGUI_PAYLOAD_TYPE_COLOR_4F // to allow your own widgets to use colors in their drag and drop interaction. @@ -1669,7 +1669,7 @@ static void DemoWindowWidgetsDragAndDrop() if (ImGui::TreeNode("Drag and drop to copy/swap items")) { - IMGUI_DEMO_MARKER("Widgets/Drag and drop/Copy-swap items"); + IMGUI_DEMO_MARKER("Widgets/Drag and Drop/Copy-swap items"); enum Mode { Mode_Copy, From cbe3d5fb887c3c5ab2949fc0762e7c4e97adeca7 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 14:34:31 +0200 Subject: [PATCH 13/72] Version 1.93.1 WIP --- docs/CHANGELOG.txt | 9 +++++++++ imgui.cpp | 2 +- imgui.h | 6 +++--- imgui_demo.cpp | 2 +- imgui_draw.cpp | 2 +- imgui_internal.h | 2 +- imgui_tables.cpp | 2 +- imgui_widgets.cpp | 2 +- misc/freetype/imgui_freetype.cpp | 3 ++- misc/freetype/imgui_freetype.h | 4 +++- 10 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index b5d983005..7389bba68 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -35,6 +35,15 @@ HOW TO UPDATE? and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users. - Please report any issue! +----------------------------------------------------------------------- + VERSION 1.93.1 WIP (In Progress) +----------------------------------------------------------------------- + +Breaking Changes: + +Other Changes: + + ----------------------------------------------------------------------- VERSION 1.93.0 (Released 2026-10-14) ----------------------------------------------------------------------- diff --git a/imgui.cpp b/imgui.cpp index 3705e7262..4a4e1fe61 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 +// dear imgui, v1.93.1 WIP // (main code and documentation) // Help: diff --git a/imgui.h b/imgui.h index a7b071dab..3e9a75715 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 +// dear imgui, v1.93.1 WIP // (headers) // Help: @@ -29,8 +29,8 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') -#define IMGUI_VERSION "1.93.0" -#define IMGUI_VERSION_NUM 19300 +#define IMGUI_VERSION "1.93.1 WIP" +#define IMGUI_VERSION_NUM 19301 #define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000 #define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198 diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 1337d60ba..14da0ee79 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 +// dear imgui, v1.93.1 WIP // (demo code) // Help: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 0d54ee8ad..9e4b1400e 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 +// dear imgui, v1.93.1 WIP // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index 420f070e8..14b8ce158 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 +// dear imgui, v1.93.1 WIP // (internal structures/api) // You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility. diff --git a/imgui_tables.cpp b/imgui_tables.cpp index a1757ed3f..ee208d160 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 +// dear imgui, v1.93.1 WIP // (tables and columns code) /* diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 821b15f44..3efccab30 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.93.0 +// dear imgui, v1.93.1 WIP // (widgets code) /* diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index 375863fdf..975374554 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -1,5 +1,6 @@ -// dear imgui: FreeType font builder (used as a replacement for the stb_truetype builder) +// dear imgui: FreeType font builder // (code) +// (used as a replacement for the stb_truetype builder) // Get the latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype // Original code by @vuhdo (Aleksei Skriabin) in 2017, with improvements by @mikesart. diff --git a/misc/freetype/imgui_freetype.h b/misc/freetype/imgui_freetype.h index 85313699d..d271d49da 100644 --- a/misc/freetype/imgui_freetype.h +++ b/misc/freetype/imgui_freetype.h @@ -1,5 +1,6 @@ -// dear imgui: FreeType font builder (used as a replacement for the stb_truetype builder) +// dear imgui: FreeType font builder // (headers) +// (used as a replacement for the stb_truetype builder) #pragma once #include "imgui.h" // IMGUI_API @@ -40,6 +41,7 @@ enum ImGuiFreeTypeLoaderFlags_ ImGuiFreeTypeLoaderFlags_Bitmap = 1 << 9, // Enable FreeType bitmap glyphs #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + // Renamed in 1.92.0 (June 2025) ImGuiFreeTypeBuilderFlags_NoHinting = ImGuiFreeTypeLoaderFlags_NoHinting, ImGuiFreeTypeBuilderFlags_NoAutoHint = ImGuiFreeTypeLoaderFlags_NoAutoHint, ImGuiFreeTypeBuilderFlags_ForceAutoHint = ImGuiFreeTypeLoaderFlags_ForceAutoHint, From 93a14c8fda0068cc93f726719422dc319bdbb5e7 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 14:51:48 +0200 Subject: [PATCH 14/72] (Breaking) Commented out legacy names/functions which were obsoleted from 1.90.7 (May 2024) to 1.91.0 (Sept 2024). --- docs/CHANGELOG.txt | 16 ++++++++++++++++ imgui.cpp | 10 ++++++++++ imgui.h | 25 +++++++++++++------------ 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 7389bba68..52e22d779 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -41,6 +41,22 @@ HOW TO UPDATE? Breaking Changes: +Autumn cleanup of stuff marked obsolete more than two years ago: + +- Commented out legacy names/functions which were obsoleted in 1.90.7 (May 2024); + - `ImGuiMod_Shortcut` --> `ImGuiMod_Ctrl` (since 1.90.7 it maps to Cmd on macOS) +- Commented out legacy names/functions which were obsoleted in 1.90.9 (July 2024); + - `ImGuiCol_TabActive` --> `ImGuiCol_TabSelected` + - `ImGuiCol_TabUnfocused` --> `ImGuiCol_TabDimmed` + - `ImGuiCol_TabUnfocusedActive` --> `ImGuiCol_TabDimmedSelected` +- Commented out legacy names/functions which were obsoleted in 1.91.0 (July 2024); + - `ImGuiSelectableFlags_DontClosePopups` --> `ImGuiSelectableFlags_NoAutoClosePopups` + - `PushButtonRepeat(bool repeat)` --> `PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat)` + - `PopButtonRepeat()` --> `PopItemFlag()` + - `PushTabStop(bool tab_stop)` --> `PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop);` + - `PopTabStop()` --> `PopItemFlag()` + + Other Changes: diff --git a/imgui.cpp b/imgui.cpp index 4a4e1fe61..7947d5b72 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -395,6 +395,16 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures: When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. You can read releases logs https://github.com/ocornut/imgui/releases for more details. + 2026/10/15 (1.93.1) - commented out legacy names/functions which were obsoleted from 1.90.7 (May 2024) to 1.91.1 (Sept 2024): + - `ImGuiMod_Shortcut` --> `ImGuiMod_Ctrl` (since 1.90.7 it maps to Cmd on macOS) + - `ImGuiCol_TabActive` --> `ImGuiCol_TabSelected` + - `ImGuiCol_TabUnfocused` --> `ImGuiCol_TabDimmed` + - `ImGuiCol_TabUnfocusedActive` --> `ImGuiCol_TabDimmedSelected` + - `ImGuiSelectableFlags_DontClosePopups`-> `ImGuiSelectableFlags_NoAutoClosePopups` + - `PushButtonRepeat(bool repeat)` --> `PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat)` + - `PopButtonRepeat()` --> `PopItemFlag()` + - `PushTabStop(bool tab_stop)` --> `PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop);` + - `PopTabStop()` --> `PopItemFlag()` 2026/10/07 (1.93.0) - large cleanup/refactor of ImDrawList. many issues and inconsistencies fixed! (#9504) BELOW IS A SIMPLIFIED/SHORTENED RECAP OF CHANGES. READ CHANGELOG AND LINKS ABOVE FOR MORE DETAILS! useful links: diff --git a/imgui.h b/imgui.h index 3e9a75715..c9db02149 100644 --- a/imgui.h +++ b/imgui.h @@ -1409,7 +1409,7 @@ enum ImGuiSelectableFlags_ ImGuiSelectableFlags_SelectOnNav = 1 << 6, // Auto-select when moved into, unless Ctrl is held. Automatic when in a BeginMultiSelect() block. #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - ImGuiSelectableFlags_DontClosePopups = ImGuiSelectableFlags_NoAutoClosePopups, // Renamed in 1.91.0 + //ImGuiSelectableFlags_DontClosePopups = ImGuiSelectableFlags_NoAutoClosePopups, // Renamed in 1.91.0 //ImGuiSelectableFlags_AllowItemOverlap = ImGuiSelectableFlags_AllowOverlap, // Renamed in 1.89.7 #endif }; @@ -1712,7 +1712,7 @@ enum ImGuiKey : int #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS ImGuiKey_COUNT = ImGuiKey_NamedKey_END, // Obsoleted in 1.91.5 because it was misleading (since named keys don't start at 0 anymore) - ImGuiMod_Shortcut = ImGuiMod_Ctrl, // Removed in 1.90.7, you can now simply use ImGuiMod_Ctrl + //ImGuiMod_Shortcut = ImGuiMod_Ctrl, // Removed in 1.90.7, you can now simply use ImGuiMod_Ctrl (will auto map to Cmd on Mac) //ImGuiKey_ModCtrl = ImGuiMod_Ctrl, ImGuiKey_ModShift = ImGuiMod_Shift, ImGuiKey_ModAlt = ImGuiMod_Alt, ImGuiKey_ModSuper = ImGuiMod_Super, // Renamed in 1.89 //ImGuiKey_KeyPadEnter = ImGuiKey_KeypadEnter, // Renamed in 1.87 #endif @@ -1841,10 +1841,10 @@ enum ImGuiCol_ ImGuiCol_COUNT, #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - ImGuiCol_TabActive = ImGuiCol_TabSelected, // [renamed in 1.90.9] - ImGuiCol_TabUnfocused = ImGuiCol_TabDimmed, // [renamed in 1.90.9] - ImGuiCol_TabUnfocusedActive = ImGuiCol_TabDimmedSelected, // [renamed in 1.90.9] - ImGuiCol_NavHighlight = ImGuiCol_NavCursor, // [renamed in 1.91.4] + ImGuiCol_NavHighlight = ImGuiCol_NavCursor, // [renamed in 1.91.4] + //ImGuiCol_TabActive = ImGuiCol_TabSelected, // [renamed in 1.90.9] + //ImGuiCol_TabUnfocused = ImGuiCol_TabDimmed, // [renamed in 1.90.9] + //ImGuiCol_TabUnfocusedActive = ImGuiCol_TabDimmedSelected, // [renamed in 1.90.9] #endif }; @@ -2680,7 +2680,7 @@ struct ImGuiIO #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS float FontGlobalScale; // Moved io.FontGlobalScale to style.FontScaleMain in 1.92.0 (June 2025) - // Legacy: before 1.91.1, clipboard functions were stored in ImGuiIO instead of ImGuiPlatformIO. + // [Moved in 1.91.1] Clipboard functions were stored in ImGuiIO instead of ImGuiPlatformIO. // As this is will affect all users of custom engines/backends, we are providing proper legacy redirection (will obsolete). const char* (*GetClipboardTextFn)(void* user_data); void (*SetClipboardTextFn)(void* user_data, const char* text); @@ -3599,7 +3599,7 @@ struct ImDrawData ImVector* Textures; // List of textures to update. Most of the times the list is shared by all ImDrawData, has only 1 texture and it doesn't need any update. This almost always points to ImGui::GetPlatformIO().Textures[]. May be overridden or set to NULL if you want to manually update textures. #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - int CmdListsCount; // Use CmdLists.Size instead. Number of ImDrawList* to render. + int CmdListsCount; // [OBSOLETED in 1.92.9] Use CmdLists.Size instead. Number of ImDrawList* to render. #endif // Functions @@ -4231,16 +4231,17 @@ namespace ImGui // OBSOLETED in 1.91.9 (from February 2025) IMGUI_API void Image(ImTextureRef tex_ref, const ImVec2& image_size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col); // <-- 'border_col' was removed in favor of ImGuiCol_ImageBorder. If you use 'tint_col', use ImageWithBg() instead. // OBSOLETED in 1.91.0 (from July 2024) - inline void PushButtonRepeat(bool repeat) { PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat); } - inline void PopButtonRepeat() { PopItemFlag(); } - inline void PushTabStop(bool tab_stop) { PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); } - inline void PopTabStop() { PopItemFlag(); } // You do not need those functions! See #7838 on GitHub for more info. IMGUI_API ImVec2 GetContentRegionMax(); // Content boundaries max (e.g. window boundaries including scrolling, or current column boundaries). You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()! IMGUI_API ImVec2 GetWindowContentRegionMin(); // Content boundaries min for the window (roughly (0,0)-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()! IMGUI_API ImVec2 GetWindowContentRegionMax(); // Content boundaries max for the window (roughly (0,0)+Size-Scroll), in window-local coordinates. You should never need this. Always use GetCursorScreenPos() and GetContentRegionAvail()! // Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE) + // OBSOLETED in 1.91.0 (from July 2024) + //inline void PushButtonRepeat(bool repeat) { PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat); } + //inline void PopButtonRepeat() { PopItemFlag(); } + //inline void PushTabStop(bool tab_stop) { PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); } + //inline void PopTabStop() { PopItemFlag(); } // OBSOLETED in 1.90.0 (from September 2023) //IMGUI_API bool Combo(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int popup_max_height_in_items = -1); // Getter signature changed. See 2023/09/15 and 2026/02/27 commits. //IMGUI_API bool ListBox(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int height_in_items = -1); // Getter signature changed. See 2023/09/15 and 2026/02/27 commits. From 1ff218165d71800455a1e8432bada8266f6d5cca Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 14:52:02 +0200 Subject: [PATCH 15/72] (Breaking) Commented out legacy names/functions which were obsoleted in 1.91.1 (Sept 2024). --- docs/CHANGELOG.txt | 7 +++++++ imgui.cpp | 11 +++++++---- imgui.h | 6 +++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 52e22d779..50b16b595 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -55,6 +55,13 @@ Autumn cleanup of stuff marked obsolete more than two years ago: - `PopButtonRepeat()` --> `PopItemFlag()` - `PushTabStop(bool tab_stop)` --> `PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop);` - `PopTabStop()` --> `PopItemFlag()` +- Commented out legacy names/functions which were obsoleted in 1.91.1 (Sept 2024); + - `io.GetClipboardTextFn` --> `platform_io.Platform_GetClipboardTextFn` + - `io.SetClipboardTextFn` --> `platform_io.Platform_SetClipboardTextFn` + - `io.ClipboardUserData` --> `platform_io.Platform_ClipboardUserData` + +Please also try to get rid of calls to `GetContentRegionMax()`, `GetWindowContentRegionMin()` +and `GetWindowContentRegionMax()`: you do NOT need those functions. See #7838. Other Changes: diff --git a/imgui.cpp b/imgui.cpp index 7947d5b72..256486f6b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -405,6 +405,9 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures: - `PopButtonRepeat()` --> `PopItemFlag()` - `PushTabStop(bool tab_stop)` --> `PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop);` - `PopTabStop()` --> `PopItemFlag()` + - `io.GetClipboardTextFn` --> `platform_io.Platform_GetClipboardTextFn` + - `io.SetClipboardTextFn` --> `platform_io.Platform_SetClipboardTextFn` + - `io.ClipboardUserData` --> `platform_io.Platform_ClipboardUserData` 2026/10/07 (1.93.0) - large cleanup/refactor of ImDrawList. many issues and inconsistencies fixed! (#9504) BELOW IS A SIMPLIFIED/SHORTENED RECAP OF CHANGES. READ CHANGELOG AND LINKS ABOVE FOR MORE DETAILS! useful links: @@ -11254,10 +11257,10 @@ static void ImGui::ErrorCheckNewFrameSanityChecks() } // Remap legacy clipboard handlers (OBSOLETED in 1.91.1, August 2024) - if (g.IO.GetClipboardTextFn != NULL && (g.PlatformIO.Platform_GetClipboardTextFn == NULL || g.PlatformIO.Platform_GetClipboardTextFn == Platform_GetClipboardTextFn_DefaultImpl)) - g.PlatformIO.Platform_GetClipboardTextFn = [](ImGuiContext* ctx) { return ctx->IO.GetClipboardTextFn(ctx->IO.ClipboardUserData); }; - if (g.IO.SetClipboardTextFn != NULL && (g.PlatformIO.Platform_SetClipboardTextFn == NULL || g.PlatformIO.Platform_SetClipboardTextFn == Platform_SetClipboardTextFn_DefaultImpl)) - g.PlatformIO.Platform_SetClipboardTextFn = [](ImGuiContext* ctx, const char* text) { return ctx->IO.SetClipboardTextFn(ctx->IO.ClipboardUserData, text); }; + //if (g.IO.GetClipboardTextFn != NULL && (g.PlatformIO.Platform_GetClipboardTextFn == NULL || g.PlatformIO.Platform_GetClipboardTextFn == Platform_GetClipboardTextFn_DefaultImpl)) + // g.PlatformIO.Platform_GetClipboardTextFn = [](ImGuiContext* ctx) { return ctx->IO.GetClipboardTextFn(ctx->IO.ClipboardUserData); }; + //if (g.IO.SetClipboardTextFn != NULL && (g.PlatformIO.Platform_SetClipboardTextFn == NULL || g.PlatformIO.Platform_SetClipboardTextFn == Platform_SetClipboardTextFn_DefaultImpl)) + // g.PlatformIO.Platform_SetClipboardTextFn = [](ImGuiContext* ctx, const char* text) { return ctx->IO.SetClipboardTextFn(ctx->IO.ClipboardUserData, text); }; // Remap legacy CurveTessellationTol into CurveTessellationMaxError (OBSOLETED in 1.93.0, August 2026) if (g.Style.CurveTessellationTol != 0.0f) diff --git a/imgui.h b/imgui.h index c9db02149..18ca1a33d 100644 --- a/imgui.h +++ b/imgui.h @@ -2682,9 +2682,9 @@ struct ImGuiIO // [Moved in 1.91.1] Clipboard functions were stored in ImGuiIO instead of ImGuiPlatformIO. // As this is will affect all users of custom engines/backends, we are providing proper legacy redirection (will obsolete). - const char* (*GetClipboardTextFn)(void* user_data); - void (*SetClipboardTextFn)(void* user_data, const char* text); - void* ClipboardUserData; + //const char* (*GetClipboardTextFn)(void* user_data); // --> `platform_io.Platform_GetClipboardTextFn` + //void (*SetClipboardTextFn)(void* user_data, const char* text); // --> `platform_io.Platform_SetClipboardTextFn` + //void* ClipboardUserData; // --> `platform_io.Platform_ClipboardUserData` //void ClearInputCharacters() { InputQueueCharacters.resize(0); } // [Obsoleted in 1.89.8] Clear the current frame text input buffer. Now included within ClearInputKeys(). Removed this as it is ambiguous/misleading and generally incorrect to use with the existence of a higher-level input queue. #endif From 4c9c888fc5f5fec3de99de61e05dcfc86259394a Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 15:39:58 +0200 Subject: [PATCH 16/72] Build: warning fixes for VS2015 and Size; - bool value_changed = memcmp(p_v, &g.ActiveIdValueOnActivation, data_size); + bool value_changed = memcmp(p_v, &g.ActiveIdValueOnActivation, data_size) != 0; memcpy(p_v, &g.ActiveIdValueOnActivation, data_size); ClearActiveID(); return value_changed; @@ -3322,7 +3322,7 @@ bool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type { // Canceling action reverts to initial value size_t data_size = DataTypeGetInfo(data_type)->Size; - bool value_changed = memcmp(p_v, &g.ActiveIdValueOnActivation, data_size); + bool value_changed = memcmp(p_v, &g.ActiveIdValueOnActivation, data_size) != 0; memcpy(p_v, &g.ActiveIdValueOnActivation, data_size); ClearActiveID(); return value_changed; From 145a2fbab64b320f8755f299eeb305c9d5e43c18 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 16:24:58 +0200 Subject: [PATCH 17/72] Docs: update binaries. --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 91bc92cde..517f32a9f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -113,7 +113,7 @@ Calling the `ImGui::ShowDemoWindow()` function will create a demo window showcas - [imgui_explorer](https://pthom.github.io/imgui_explorer): Web version of the demo w/ source code browser, courtesy of [@pthom](https://github.com/pthom). You should be able to build the examples from sources. If you don't, let us know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here: -- [imgui-demo-binaries-20260225.zip](https://www.dearimgui.com/binaries/imgui-demo-binaries-20260225.zip) (Windows, 1.92.6, built 2026/02/25, master) or [older binaries](https://www.dearimgui.com/binaries). +- [imgui-demo-binaries-20261015.zip](https://www.dearimgui.com/binaries/imgui-demo-binaries-20261015.zip) (Win32, 1.93.0, built 2026/10/15, master) or [older binaries](https://www.dearimgui.com/binaries). ### Gallery From f5d2b7dd01205b0f389ee26d11aa1b767ee87c94 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 16:32:52 +0200 Subject: [PATCH 18/72] CI: fixes for macOS. --- .github/workflows/build.yml | 2 +- docs/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e276e1de..0dcab4688 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -523,7 +523,7 @@ jobs: - name: Install Dependencies run: | - brew install glfw3 sdl2 sdl3 + brew install glfw sdl2 sdl3 - name: Build example_null (extra warnings, clang 64-bit) run: make -C examples/example_null WITH_EXTRA_WARNINGS=1 diff --git a/docs/README.md b/docs/README.md index 517f32a9f..1dea58176 100644 --- a/docs/README.md +++ b/docs/README.md @@ -113,7 +113,7 @@ Calling the `ImGui::ShowDemoWindow()` function will create a demo window showcas - [imgui_explorer](https://pthom.github.io/imgui_explorer): Web version of the demo w/ source code browser, courtesy of [@pthom](https://github.com/pthom). You should be able to build the examples from sources. If you don't, let us know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here: -- [imgui-demo-binaries-20261015.zip](https://www.dearimgui.com/binaries/imgui-demo-binaries-20261015.zip) (Win32, 1.93.0, built 2026/10/15, master) or [older binaries](https://www.dearimgui.com/binaries). +- [imgui-demo-binaries-20261015-win32.zip](https://www.dearimgui.com/binaries/imgui-demo-binaries-20261015-win32.zip) (Win32, 1.93.0, built 2026/10/15, master) or [older binaries](https://www.dearimgui.com/binaries). ### Gallery From c7d17f01cd3e14bbc9b33cee44e0a2d6f3a2a524 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 17:56:20 +0200 Subject: [PATCH 19/72] ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2 --- docs/CHANGELOG.txt | 10 +++++++--- imgui.cpp | 9 +++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 50b16b595..0576968ca 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -59,13 +59,17 @@ Autumn cleanup of stuff marked obsolete more than two years ago: - `io.GetClipboardTextFn` --> `platform_io.Platform_GetClipboardTextFn` - `io.SetClipboardTextFn` --> `platform_io.Platform_SetClipboardTextFn` - `io.ClipboardUserData` --> `platform_io.Platform_ClipboardUserData` - -Please also try to get rid of calls to `GetContentRegionMax()`, `GetWindowContentRegionMin()` -and `GetWindowContentRegionMax()`: you do NOT need those functions. See #7838. +- Please also try to get rid of calls to `GetContentRegionMax()`, `GetWindowContentRegionMin()` + and `GetWindowContentRegionMax()` will may be removed soon-ish: you should not + ever need those functions. See #7838. Other Changes: +- ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro + adds an extra `operator=` to ImVec2. This isn't supported but should not + be needed as you should have a constructor to convert from your type to ImVec2. + ----------------------------------------------------------------------- VERSION 1.93.0 (Released 2026-10-14) diff --git a/imgui.cpp b/imgui.cpp index 256486f6b..a970e92ca 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -11208,6 +11208,15 @@ static void ImGui::ErrorCheckNewFrameSanityChecks() // #define IM_ASSERT(EXPR) do { if (SomeCode(EXPR)) SomeMoreCode(); } while (0) // Correct! if (true) IM_ASSERT(1); else IM_ASSERT(0); + // Check user IM_VEC2_CLASS_EXTRA macro + // (IF YOU GET A "ambiguous overload" COMPILE ERROR HERE: does your IM_VEC2_CLASS_EXTRA macro contains an operator=? + // e.g. ImVec2& operator=(const MyPoint & p) { x = p.x; y = p.y; return *this; } + // You should be able to remove it if you have the corresponding constructor: + // e.g. IM_NODEBUGSTEP constexpr inline ImVec2(const MyPoint& f) : x(f.x), y(f.y) {} + // Allowing you to add this extra operator to ImVec2 would prevent our whole codebase from using v = {x,y} assignment style. + // PLEASE GET IN TOUCH IF REMOVING THE operator= IS A PROBLEM TO YOU) + ImVec2 v; v = { 1.0f, 2.0f }; + // Emscripten backends are often imprecise in their submission of DeltaTime. (#6114, #3644) // Ideally the Emscripten app/backend should aim to fix or smooth this value and avoid feeding zero, but we tolerate it. #ifdef __EMSCRIPTEN__ From 49a14503601b08c23ea137944cdb293a4ff08a2e Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 18:53:04 +0200 Subject: [PATCH 20/72] DrawList: added missing ImDrawFlags_RoundCornersMask_ -> ImDrawFlags_RoundMask_ legacy redirect. Amend 0e756a6. --- docs/CHANGELOG.txt | 1 + imgui.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 0576968ca..609b3ba60 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -205,6 +205,7 @@ Breaking Changes: - `ImDrawFlags_RoundCornersBottom` -> `ImDrawFlags_RoundBottom` - `ImDrawFlags_RoundCornersLeft` -> `ImDrawFlags_RoundLeft` - `ImDrawFlags_RoundCornersRight` -> `ImDrawFlags_RoundRight` + - `ImDrawFlags_RoundCornersMask_` -> `ImDrawFlags_RoundMask_` Kept redirection enums (will obsolete). - Marked `ImDrawListFlags_AntiAliasedLinesUseTex` and `style.AntiAliasedLinesUseTex` as obsolete, as the new line rendering code always uses textures. diff --git a/imgui.h b/imgui.h index 18ca1a33d..fdbcf80ba 100644 --- a/imgui.h +++ b/imgui.h @@ -3391,7 +3391,8 @@ enum ImDrawFlags_ ImDrawFlags_RoundCornersTop = ImDrawFlags_RoundTop, ImDrawFlags_RoundCornersBottom = ImDrawFlags_RoundBottom, ImDrawFlags_RoundCornersLeft = ImDrawFlags_RoundLeft, - ImDrawFlags_RoundCornersRight = ImDrawFlags_RoundRight, + ImDrawFlags_RoundCornersRight = ImDrawFlags_RoundRight, + ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundMask_, #endif }; From 9d9a621f339460e8a9dc49b2ad164d6acade1aff Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 19:41:17 +0200 Subject: [PATCH 21/72] Fonts: expose ImFontBaked_BuildLoadGlyphAdvanceX() in imgui_internal.h. --- imgui_draw.cpp | 2 +- imgui_internal.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 2c197dacc..f5ea37700 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -6156,7 +6156,7 @@ static ImFontGlyph* ImFontBaked_BuildLoadGlyph(ImFontBaked* baked, ImWchar codep return NULL; } -static float ImFontBaked_BuildLoadGlyphAdvanceX(ImFontBaked* baked, ImWchar codepoint) +float ImFontBaked_BuildLoadGlyphAdvanceX(ImFontBaked* baked, ImWchar codepoint) { if (baked->Size >= IMGUI_FONT_SIZE_THRESHOLD_FOR_LOADADVANCEXONLYMODE || baked->LoadNoRenderOnLayout) { diff --git a/imgui_internal.h b/imgui_internal.h index 14b8ce158..875c51f42 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -4132,6 +4132,8 @@ IMGUI_API void ImFontAtlasBakedAddFontGlyphAdvancedX(ImFontAtlas* a IMGUI_API void ImFontAtlasBakedDiscardFontGlyph(ImFontAtlas* atlas, ImFont* font, ImFontBaked* baked, ImFontGlyph* glyph); IMGUI_API void ImFontAtlasBakedSetFontGlyphBitmap(ImFontAtlas* atlas, ImFontBaked* baked, ImFontConfig* src, ImFontGlyph* glyph, ImTextureRect* r, const unsigned char* src_pixels, ImTextureFormat src_fmt, int src_pitch); +IMGUI_API float ImFontBaked_BuildLoadGlyphAdvanceX(ImFontBaked* baked, ImWchar codepoint); + IMGUI_API void ImFontAtlasPackInit(ImFontAtlas* atlas); IMGUI_API ImFontAtlasRectId ImFontAtlasPackAddRect(ImFontAtlas* atlas, int w, int h, ImFontAtlasRectEntry* overwrite_entry = NULL); IMGUI_API ImTextureRect* ImFontAtlasPackGetRect(ImFontAtlas* atlas, ImFontAtlasRectId id); From 4be0b47ecc0edd535a40a79f6ceb6f1ac5936483 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 16 Oct 2026 16:43:40 +0200 Subject: [PATCH 22/72] (Breaking) Internals: ImStricmp/ImStrnicmp returned opposite sign when strings were different + ones in Demo. Main functions unused by core imgui, so not strictly changing anything. Demo functions were only comparing to 0. --- imgui.cpp | 4 ++-- imgui_demo.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index a970e92ca..7ee86218e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2265,14 +2265,14 @@ ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, int ImStricmp(const char* str1, const char* str2) { int d; - while ((d = ImToUpper(*str2) - ImToUpper(*str1)) == 0 && *str1) { str1++; str2++; } + while ((d = ImToUpper(*str1) - ImToUpper(*str2)) == 0 && *str1) { str1++; str2++; } return d; } int ImStrnicmp(const char* str1, const char* str2, size_t count) { int d = 0; - while (count > 0 && (d = ImToUpper(*str2) - ImToUpper(*str1)) == 0 && *str1) { str1++; str2++; count--; } + while (count > 0 && (d = ImToUpper(*str1) - ImToUpper(*str2)) == 0 && *str1) { str1++; str2++; count--; } return d; } diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 14da0ee79..ede2eeb07 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -9211,8 +9211,8 @@ struct ExampleAppConsole } // Portable helpers - static int Stricmp(const char* s1, const char* s2) { int d; while ((d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; } return d; } - static int Strnicmp(const char* s1, const char* s2, int n) { int d = 0; while (n > 0 && (d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; n--; } return d; } + static int Stricmp(const char* s1, const char* s2) { int d; while ((d = toupper(*s1) - toupper(*s2)) == 0 && *s1) { s1++; s2++; } return d; } + static int Strnicmp(const char* s1, const char* s2, int n) { int d = 0; while (n > 0 && (d = toupper(*s1) - toupper(*s2)) == 0 && *s1) { s1++; s2++; n--; } return d; } static char* Strdup(const char* s) { IM_ASSERT(s); size_t len = strlen(s) + 1; void* buf = ImGui::MemAlloc(len); IM_ASSERT(buf); return (char*)memcpy(buf, (const void*)s, len); } static void Strtrimblanks(char* s) { char* str_end = s + strlen(s); while (str_end > s && str_end[-1] == ' ') str_end--; *str_end = 0; } From 7bd38119c7288d77de31cde9a7eeb568405090c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cicho=C5=84?= Date: Fri, 23 Oct 2026 14:22:52 +0200 Subject: [PATCH 23/72] Internals: CallContextHooks(): fixed iterating a reallocated array when a hook callback adds a hook. (#9590) Note that Test Engine GuiFunc code is called within a hook anyhow. --- imgui.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 7ee86218e..585e8a9b2 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4740,12 +4740,13 @@ void ImGui::RemoveContextHook(ImGuiContext* ctx, ImGuiID hook_id) // Call context hooks (used by e.g. test engine) // We assume a small number of hooks so all stored in same array +// Iterate by index: a callback may add a hook, which reallocates the array. Hooks added here are called from the next call. void ImGui::CallContextHooks(ImGuiContext* ctx, ImGuiContextHookType hook_type) { ImGuiContext& g = *ctx; - for (ImGuiContextHook& hook : g.Hooks) - if (hook.Type == hook_type) - hook.Callback(&g, &hook); + for (int n = 0, hooks_count = g.Hooks.Size; n < hooks_count; n++) + if (g.Hooks[n].Type == hook_type) + g.Hooks[n].Callback(&g, &g.Hooks[n]); } //----------------------------------------------------------------------------- From 2b7a9dcca44011a1ff82833bfeab6a66b8213a71 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 23 Oct 2026 14:41:01 +0200 Subject: [PATCH 24/72] Examples: remove references to DXSDK_DIR which is for DX9. (realized this while reviewing #9593) --- examples/example_null/example_null.vcxproj | 20 +++++++++++-------- .../example_sdl2_directx11/build_win32.bat | 4 ++-- .../example_sdl2_directx11.vcxproj | 10 +++++----- .../example_sdl3_directx11/build_win32.bat | 4 ++-- .../example_sdl3_directx11.vcxproj | 10 +++++----- .../example_win32_directx10/build_win32.bat | 4 ++-- .../example_win32_directx10.vcxproj | 10 +++++----- .../example_win32_directx11/build_win32.bat | 4 ++-- .../example_win32_directx11.vcxproj | 10 +++++----- 9 files changed, 40 insertions(+), 36 deletions(-) diff --git a/examples/example_null/example_null.vcxproj b/examples/example_null/example_null.vcxproj index 61e388f96..1353fc0b3 100644 --- a/examples/example_null/example_null.vcxproj +++ b/examples/example_null/example_null.vcxproj @@ -92,8 +92,9 @@ true - d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + + + %(AdditionalLibraryDirectories) Console @@ -107,8 +108,9 @@ true - d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + + + %(AdditionalLibraryDirectories) Console @@ -126,8 +128,9 @@ true true true - d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + + + %(AdditionalLibraryDirectories) Console @@ -145,8 +148,9 @@ true true true - d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + + + %(AdditionalLibraryDirectories) Console diff --git a/examples/example_sdl2_directx11/build_win32.bat b/examples/example_sdl2_directx11/build_win32.bat index f0b485ca6..135c3bb50 100644 --- a/examples/example_sdl2_directx11/build_win32.bat +++ b/examples/example_sdl2_directx11/build_win32.bat @@ -1,8 +1,8 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug @set OUT_EXE=example_sdl2_directx11 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" @set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib shell32.lib +@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib d3d11.lib d3dcompiler.lib shell32.lib mkdir %OUT_DIR% cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj b/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj index afa9d5de4..4ba9ac321 100644 --- a/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj +++ b/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj @@ -97,7 +97,7 @@ true - %SDL2_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + %SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories) SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) Console msvcrt.lib @@ -113,7 +113,7 @@ true - %SDL2_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + %SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories) SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) Console msvcrt.lib @@ -133,7 +133,7 @@ true true true - %SDL2_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + %SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories) SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) Console @@ -154,7 +154,7 @@ true true true - %SDL2_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + %SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories) SDL2.lib;SDL2main.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) Console @@ -186,4 +186,4 @@ - \ No newline at end of file + diff --git a/examples/example_sdl3_directx11/build_win32.bat b/examples/example_sdl3_directx11/build_win32.bat index b84b01f1a..41bb8449b 100644 --- a/examples/example_sdl3_directx11/build_win32.bat +++ b/examples/example_sdl3_directx11/build_win32.bat @@ -1,8 +1,8 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug @set OUT_EXE=example_sdl3_directx11 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" @set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib shell32.lib +@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib d3d11.lib d3dcompiler.lib shell32.lib mkdir %OUT_DIR% cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_directx11/example_sdl3_directx11.vcxproj b/examples/example_sdl3_directx11/example_sdl3_directx11.vcxproj index 057874196..8729480a5 100644 --- a/examples/example_sdl3_directx11/example_sdl3_directx11.vcxproj +++ b/examples/example_sdl3_directx11/example_sdl3_directx11.vcxproj @@ -97,7 +97,7 @@ true - %SDL3_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + %SDL3_DIR%\lib\x86;%(AdditionalLibraryDirectories) SDL3.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) Console msvcrt.lib @@ -113,7 +113,7 @@ true - %SDL3_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + %SDL3_DIR%\lib\x64;%(AdditionalLibraryDirectories) SDL3.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) Console msvcrt.lib @@ -133,7 +133,7 @@ true true true - %SDL3_DIR%\lib\x86;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + %SDL3_DIR%\lib\x86;%(AdditionalLibraryDirectories) SDL3.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) Console @@ -154,7 +154,7 @@ true true true - %SDL3_DIR%\lib\x64;$(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + %SDL3_DIR%\lib\x64;%(AdditionalLibraryDirectories) SDL3.lib;d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) Console @@ -186,4 +186,4 @@ - \ No newline at end of file + diff --git a/examples/example_win32_directx10/build_win32.bat b/examples/example_win32_directx10/build_win32.bat index 78a6e374d..b65d31ab2 100644 --- a/examples/example_win32_directx10/build_win32.bat +++ b/examples/example_win32_directx10/build_win32.bat @@ -1,8 +1,8 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug @set OUT_EXE=example_win32_directx10 -@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" +@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" @set SOURCES=main.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\backends\imgui_impl_dx10.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d10.lib d3dcompiler.lib +@set LIBS=d3d10.lib d3dcompiler.lib mkdir %OUT_DIR% cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_win32_directx10/example_win32_directx10.vcxproj b/examples/example_win32_directx10/example_win32_directx10.vcxproj index add37ed97..89e9393ab 100644 --- a/examples/example_win32_directx10/example_win32_directx10.vcxproj +++ b/examples/example_win32_directx10/example_win32_directx10.vcxproj @@ -93,7 +93,7 @@ true d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) Console @@ -108,7 +108,7 @@ true d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) Console @@ -127,7 +127,7 @@ true true d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) Console @@ -146,7 +146,7 @@ true true d3d10.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) Console @@ -175,4 +175,4 @@ - \ No newline at end of file + diff --git a/examples/example_win32_directx11/build_win32.bat b/examples/example_win32_directx11/build_win32.bat index c9a717c60..fb4c09cf2 100644 --- a/examples/example_win32_directx11/build_win32.bat +++ b/examples/example_win32_directx11/build_win32.bat @@ -1,9 +1,9 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug @set OUT_EXE=example_win32_directx11 -@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" +@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" @set SOURCES=main.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib +@set LIBS=d3d11.lib d3dcompiler.lib mkdir %OUT_DIR% cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_win32_directx11/example_win32_directx11.vcxproj b/examples/example_win32_directx11/example_win32_directx11.vcxproj index ed0b509a8..ace899cb5 100644 --- a/examples/example_win32_directx11/example_win32_directx11.vcxproj +++ b/examples/example_win32_directx11/example_win32_directx11.vcxproj @@ -93,7 +93,7 @@ true d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) Console @@ -108,7 +108,7 @@ true d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) Console @@ -127,7 +127,7 @@ true true d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) Console @@ -146,7 +146,7 @@ true true d3d11.lib;d3dcompiler.lib;dxgi.lib;%(AdditionalDependencies) - $(DXSDK_DIR)/Lib/x64;%(AdditionalLibraryDirectories) + %(AdditionalLibraryDirectories) Console @@ -175,4 +175,4 @@ - \ No newline at end of file + From 6dd654f27a8dbfe8c81b7ed98a5e16539da68e74 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 23 Oct 2026 15:08:53 +0200 Subject: [PATCH 25/72] Examples: renamed various helper batch files from build_win32.bat to build_win.bat. (also came to this while reviewing #9593) --- .github/workflows/build.yml | 2 +- docs/CHANGELOG.txt | 3 +++ examples/example_null/{build_win32.bat => build_win.bat} | 2 +- .../example_win32_directx10/{build_win32.bat => build_win.bat} | 2 +- .../example_win32_directx11/{build_win32.bat => build_win.bat} | 2 +- .../example_win32_directx12/{build_win32.bat => build_win.bat} | 2 +- .../example_win32_opengl3/{build_win32.bat => build_win.bat} | 2 +- 7 files changed, 9 insertions(+), 6 deletions(-) rename examples/example_null/{build_win32.bat => build_win.bat} (74%) rename examples/example_win32_directx10/{build_win32.bat => build_win.bat} (88%) rename examples/example_win32_directx11/{build_win32.bat => build_win.bat} (88%) rename examples/example_win32_directx12/{build_win32.bat => build_win.bat} (88%) rename examples/example_win32_opengl3/{build_win32.bat => build_win.bat} (86%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dcab4688..fa3496d83 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,7 +77,7 @@ jobs: run: | cd examples\example_null call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat" - .\build_win32.bat /W4 + .\build_win.bat /W4 - name: Build example_null (single file build) shell: bash diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 609b3ba60..c05cb8961 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -69,6 +69,9 @@ Other Changes: - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. +- Examples: renamed various helper batch files from build_win32.bat to build_win.bat + to reflect that they can also build X64 or ARM64, given the right environment. + Kept both build_win32.bat and build_win64.bat for examples needing them. ----------------------------------------------------------------------- diff --git a/examples/example_null/build_win32.bat b/examples/example_null/build_win.bat similarity index 74% rename from examples/example_null/build_win32.bat rename to examples/example_null/build_win.bat index be81d8093..6c4d4e036 100644 --- a/examples/example_null/build_win32.bat +++ b/examples/example_null/build_win.bat @@ -1,3 +1,3 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. +@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat, or vcvarsall.bat to setup command-line compiler. mkdir Debug cl /nologo /Zi /MD /utf-8 /I ..\.. %* *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib imm32.lib diff --git a/examples/example_win32_directx10/build_win32.bat b/examples/example_win32_directx10/build_win.bat similarity index 88% rename from examples/example_win32_directx10/build_win32.bat rename to examples/example_win32_directx10/build_win.bat index b65d31ab2..d7d2f5a6a 100644 --- a/examples/example_win32_directx10/build_win32.bat +++ b/examples/example_win32_directx10/build_win.bat @@ -1,4 +1,4 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. +@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug @set OUT_EXE=example_win32_directx10 @set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" diff --git a/examples/example_win32_directx11/build_win32.bat b/examples/example_win32_directx11/build_win.bat similarity index 88% rename from examples/example_win32_directx11/build_win32.bat rename to examples/example_win32_directx11/build_win.bat index fb4c09cf2..78758193d 100644 --- a/examples/example_win32_directx11/build_win32.bat +++ b/examples/example_win32_directx11/build_win.bat @@ -1,4 +1,4 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. +@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat, or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug @set OUT_EXE=example_win32_directx11 @set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" diff --git a/examples/example_win32_directx12/build_win32.bat b/examples/example_win32_directx12/build_win.bat similarity index 88% rename from examples/example_win32_directx12/build_win32.bat rename to examples/example_win32_directx12/build_win.bat index cb5e8e273..d609c7203 100644 --- a/examples/example_win32_directx12/build_win32.bat +++ b/examples/example_win32_directx12/build_win.bat @@ -1,4 +1,4 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. +@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat, or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug @set OUT_EXE=example_win32_directx12 @set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" diff --git a/examples/example_win32_opengl3/build_win32.bat b/examples/example_win32_opengl3/build_win.bat similarity index 86% rename from examples/example_win32_opengl3/build_win32.bat rename to examples/example_win32_opengl3/build_win.bat index 48df08087..0bedfc19f 100644 --- a/examples/example_win32_opengl3/build_win32.bat +++ b/examples/example_win32_opengl3/build_win.bat @@ -1,4 +1,4 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. +@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat, vcvars64.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug @set OUT_EXE=example_win32_opengl3 @set INCLUDES=/I..\.. /I..\..\backends From 20ba6c4a281fc7b21b7569c01b154b825153a123 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 23 Oct 2026 16:09:45 +0200 Subject: [PATCH 26/72] Examples: refactored remaining batch files to detect architecture. (also came to this while reviewing #9593) --- docs/CHANGELOG.txt | 2 +- examples/example_glfw_opengl2/build_win.bat | 21 ++++++++++++++++ examples/example_glfw_opengl2/build_win32.bat | 8 ------ examples/example_glfw_opengl3/build_win.bat | 21 ++++++++++++++++ examples/example_glfw_opengl3/build_win32.bat | 8 ------ examples/example_glfw_vulkan/build_win.bat | 25 +++++++++++++++++++ examples/example_glfw_vulkan/build_win32.bat | 14 ----------- examples/example_glfw_vulkan/build_win64.bat | 14 ----------- examples/example_sdl2_directx11/build_win.bat | 21 ++++++++++++++++ .../example_sdl2_directx11/build_win32.bat | 8 ------ examples/example_sdl2_opengl2/build_win.bat | 21 ++++++++++++++++ examples/example_sdl2_opengl2/build_win32.bat | 8 ------ examples/example_sdl2_opengl3/README.md | 2 +- examples/example_sdl2_opengl3/build_win.bat | 21 ++++++++++++++++ examples/example_sdl2_opengl3/build_win32.bat | 8 ------ .../example_sdl2_sdlrenderer2/build_win.bat | 21 ++++++++++++++++ .../example_sdl2_sdlrenderer2/build_win32.bat | 8 ------ examples/example_sdl2_vulkan/build_win.bat | 25 +++++++++++++++++++ examples/example_sdl2_vulkan/build_win32.bat | 14 ----------- examples/example_sdl2_vulkan/build_win64.bat | 14 ----------- examples/example_sdl3_directx11/build_win.bat | 21 ++++++++++++++++ .../example_sdl3_directx11/build_win32.bat | 8 ------ examples/example_sdl3_opengl3/README.md | 2 +- examples/example_sdl3_opengl3/build_win.bat | 25 +++++++++++++++++++ examples/example_sdl3_opengl3/build_win32.bat | 14 ----------- examples/example_sdl3_opengl3/build_win64.bat | 14 ----------- .../example_sdl3_sdlrenderer3/build_win.bat | 21 ++++++++++++++++ .../example_sdl3_sdlrenderer3/build_win32.bat | 8 ------ examples/example_sdl3_vulkan/build_win.bat | 25 +++++++++++++++++++ examples/example_sdl3_vulkan/build_win32.bat | 14 ----------- examples/example_sdl3_vulkan/build_win64.bat | 14 ----------- examples/example_win32_directx9/build_win.bat | 21 ++++++++++++++++ .../example_win32_directx9/build_win32.bat | 8 ------ examples/example_win32_vulkan/build_win.bat | 21 ++++++++++++++++ examples/example_win32_vulkan/build_win32.bat | 9 ------- examples/example_win32_vulkan/build_win64.bat | 9 ------- 36 files changed, 313 insertions(+), 205 deletions(-) create mode 100644 examples/example_glfw_opengl2/build_win.bat delete mode 100644 examples/example_glfw_opengl2/build_win32.bat create mode 100644 examples/example_glfw_opengl3/build_win.bat delete mode 100644 examples/example_glfw_opengl3/build_win32.bat create mode 100644 examples/example_glfw_vulkan/build_win.bat delete mode 100644 examples/example_glfw_vulkan/build_win32.bat delete mode 100644 examples/example_glfw_vulkan/build_win64.bat create mode 100644 examples/example_sdl2_directx11/build_win.bat delete mode 100644 examples/example_sdl2_directx11/build_win32.bat create mode 100644 examples/example_sdl2_opengl2/build_win.bat delete mode 100644 examples/example_sdl2_opengl2/build_win32.bat create mode 100644 examples/example_sdl2_opengl3/build_win.bat delete mode 100644 examples/example_sdl2_opengl3/build_win32.bat create mode 100644 examples/example_sdl2_sdlrenderer2/build_win.bat delete mode 100644 examples/example_sdl2_sdlrenderer2/build_win32.bat create mode 100644 examples/example_sdl2_vulkan/build_win.bat delete mode 100644 examples/example_sdl2_vulkan/build_win32.bat delete mode 100644 examples/example_sdl2_vulkan/build_win64.bat create mode 100644 examples/example_sdl3_directx11/build_win.bat delete mode 100644 examples/example_sdl3_directx11/build_win32.bat create mode 100644 examples/example_sdl3_opengl3/build_win.bat delete mode 100644 examples/example_sdl3_opengl3/build_win32.bat delete mode 100644 examples/example_sdl3_opengl3/build_win64.bat create mode 100644 examples/example_sdl3_sdlrenderer3/build_win.bat delete mode 100644 examples/example_sdl3_sdlrenderer3/build_win32.bat create mode 100644 examples/example_sdl3_vulkan/build_win.bat delete mode 100644 examples/example_sdl3_vulkan/build_win32.bat delete mode 100644 examples/example_sdl3_vulkan/build_win64.bat create mode 100644 examples/example_win32_directx9/build_win.bat delete mode 100644 examples/example_win32_directx9/build_win32.bat create mode 100644 examples/example_win32_vulkan/build_win.bat delete mode 100644 examples/example_win32_vulkan/build_win32.bat delete mode 100644 examples/example_win32_vulkan/build_win64.bat diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index c05cb8961..fd490de77 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -71,7 +71,7 @@ Other Changes: be needed as you should have a constructor to convert from your type to ImVec2. - Examples: renamed various helper batch files from build_win32.bat to build_win.bat to reflect that they can also build X64 or ARM64, given the right environment. - Kept both build_win32.bat and build_win64.bat for examples needing them. + Made the script detect the environment when needed (e.g. to specify library path). ----------------------------------------------------------------------- diff --git a/examples/example_glfw_opengl2/build_win.bat b/examples/example_glfw_opengl2/build_win.bat new file mode 100644 index 000000000..cca29d76f --- /dev/null +++ b/examples/example_glfw_opengl2/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_glfw_opengl2 +@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp +@set LIBS=glfw3.lib opengl32.lib gdi32.lib shell32.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-32 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_glfw_opengl2/build_win32.bat b/examples/example_glfw_opengl2/build_win32.bat deleted file mode 100644 index 24c0e08fd..000000000 --- a/examples/example_glfw_opengl2/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_glfw_opengl2 -@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_glfw_opengl3/build_win.bat b/examples/example_glfw_opengl3/build_win.bat new file mode 100644 index 000000000..a39236cdd --- /dev/null +++ b/examples/example_glfw_opengl3/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_glfw_opengl3 +@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp +@set LIBS=glfw3.lib opengl32.lib gdi32.lib shell32.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-32 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_glfw_opengl3/build_win32.bat b/examples/example_glfw_opengl3/build_win32.bat deleted file mode 100644 index b5979ad49..000000000 --- a/examples/example_glfw_opengl3/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_glfw_opengl3 -@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_glfw_vulkan/build_win.bat b/examples/example_glfw_vulkan/build_win.bat new file mode 100644 index 000000000..0366b1b5d --- /dev/null +++ b/examples/example_glfw_vulkan/build_win.bat @@ -0,0 +1,25 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_glfw_vulkan +@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp +@set LIBS=glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% + +@set OUT_DIR=Release +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_glfw_vulkan/build_win32.bat b/examples/example_glfw_vulkan/build_win32.bat deleted file mode 100644 index bb54a4210..000000000 --- a/examples/example_glfw_vulkan/build_win32.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. - -@set OUT_EXE=example_glfw_vulkan -@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% - -@set OUT_DIR=Release -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_glfw_vulkan/build_win64.bat b/examples/example_glfw_vulkan/build_win64.bat deleted file mode 100644 index ca9b788d8..000000000 --- a/examples/example_glfw_vulkan/build_win64.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup 64-bit command-line compiler. - -@set OUT_EXE=example_glfw_vulkan -@set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% - -@set OUT_DIR=Release -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_sdl2_directx11/build_win.bat b/examples/example_sdl2_directx11/build_win.bat new file mode 100644 index 000000000..6b279b937 --- /dev/null +++ b/examples/example_sdl2_directx11/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl2_directx11 +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp +@set LIBS=SDL2.lib SDL2main.lib d3d11.lib d3dcompiler.lib shell32.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_directx11/build_win32.bat b/examples/example_sdl2_directx11/build_win32.bat deleted file mode 100644 index 135c3bb50..000000000 --- a/examples/example_sdl2_directx11/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_sdl2_directx11 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib d3d11.lib d3dcompiler.lib shell32.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_opengl2/build_win.bat b/examples/example_sdl2_opengl2/build_win.bat new file mode 100644 index 000000000..945464c00 --- /dev/null +++ b/examples/example_sdl2_opengl2/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl2_opengl2 +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp +@set LIBS=SDL2.lib SDL2main.lib opengl32.lib shell32.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_opengl2/build_win32.bat b/examples/example_sdl2_opengl2/build_win32.bat deleted file mode 100644 index 7543edafc..000000000 --- a/examples/example_sdl2_opengl2/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_sdl2_opengl2 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib shell32.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_opengl3/README.md b/examples/example_sdl2_opengl3/README.md index 81fd9fe7b..e62dec255 100644 --- a/examples/example_sdl2_opengl3/README.md +++ b/examples/example_sdl2_opengl3/README.md @@ -7,7 +7,7 @@ Use the provided project file (.vcxproj). Add to solution (imgui_examples.sln) i ## Windows with Visual Studio's CLI -Use build_win32.bat or directly: +Use build_win.bat or directly: ``` set SDL2_DIR=path_to_your_sdl2_folder cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console diff --git a/examples/example_sdl2_opengl3/build_win.bat b/examples/example_sdl2_opengl3/build_win.bat new file mode 100644 index 000000000..7d8dd115c --- /dev/null +++ b/examples/example_sdl2_opengl3/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl2_opengl3 +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp +@set LIBS=SDL2.lib SDL2main.lib opengl32.lib shell32.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_opengl3/build_win32.bat b/examples/example_sdl2_opengl3/build_win32.bat deleted file mode 100644 index 7b2fac922..000000000 --- a/examples/example_sdl2_opengl3/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_sdl2_opengl3 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib shell32.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_sdlrenderer2/build_win.bat b/examples/example_sdl2_sdlrenderer2/build_win.bat new file mode 100644 index 000000000..82bc8613b --- /dev/null +++ b/examples/example_sdl2_sdlrenderer2/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl2_sdlrenderer_ +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer2.cpp ..\..\imgui*.cpp +@set LIBS=SDL2.lib SDL2main.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_sdlrenderer2/build_win32.bat b/examples/example_sdl2_sdlrenderer2/build_win32.bat deleted file mode 100644 index e311bfcd0..000000000 --- a/examples/example_sdl2_sdlrenderer2/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_sdl2_sdlrenderer_ -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer2.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_vulkan/build_win.bat b/examples/example_sdl2_vulkan/build_win.bat new file mode 100644 index 000000000..2b2fedcaa --- /dev/null +++ b/examples/example_sdl2_vulkan/build_win.bat @@ -0,0 +1,25 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl2_vulkan +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp +@set LIBS=SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL2_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console + +@set OUT_DIR=Release +@REM mkdir %OUT_DIR% +@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_vulkan/build_win32.bat b/examples/example_sdl2_vulkan/build_win32.bat deleted file mode 100644 index f634aba00..000000000 --- a/examples/example_sdl2_vulkan/build_win32.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. - -@set OUT_EXE=example_sdl2_vulkan -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console - -@set OUT_DIR=Release -@REM mkdir %OUT_DIR% -@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl2_vulkan/build_win64.bat b/examples/example_sdl2_vulkan/build_win64.bat deleted file mode 100644 index 5d315cca2..000000000 --- a/examples/example_sdl2_vulkan/build_win64.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler. - -@set OUT_EXE=example_sdl2_vulkan -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console - -@set OUT_DIR=Release -@REM mkdir %OUT_DIR% -@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_directx11/build_win.bat b/examples/example_sdl3_directx11/build_win.bat new file mode 100644 index 000000000..a619de03f --- /dev/null +++ b/examples/example_sdl3_directx11/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl3_directx11 +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp +@set LIBS=SDL3.lib d3d11.lib d3dcompiler.lib shell32.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_directx11/build_win32.bat b/examples/example_sdl3_directx11/build_win32.bat deleted file mode 100644 index 41bb8449b..000000000 --- a/examples/example_sdl3_directx11/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_sdl3_directx11 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib d3d11.lib d3dcompiler.lib shell32.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_opengl3/README.md b/examples/example_sdl3_opengl3/README.md index a032f8752..bc748afac 100644 --- a/examples/example_sdl3_opengl3/README.md +++ b/examples/example_sdl3_opengl3/README.md @@ -7,7 +7,7 @@ Use the provided project file (.vcxproj). Add to solution (imgui_examples.sln) i ## Windows with Visual Studio's CLI -Use build_win32.bat or directly: +Use build_win.bat or directly: ``` set SDL3_DIR=path_to_your_sdl3_folder cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL3_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl3_opengl3.exe /FoDebug/ /link /libpath:%SDL3_DIR%\lib\x86 SDL3.lib opengl32.lib /subsystem:console diff --git a/examples/example_sdl3_opengl3/build_win.bat b/examples/example_sdl3_opengl3/build_win.bat new file mode 100644 index 000000000..0eeef3e0c --- /dev/null +++ b/examples/example_sdl3_opengl3/build_win.bat @@ -0,0 +1,25 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl3_opengl3 +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp +@set LIBS=SDL3.lib opengl32.lib shell32.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console + +@set OUT_DIR=Release +@REM mkdir %OUT_DIR% +@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_opengl3/build_win32.bat b/examples/example_sdl3_opengl3/build_win32.bat deleted file mode 100644 index 5bed40ac1..000000000 --- a/examples/example_sdl3_opengl3/build_win32.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. - -@set OUT_EXE=example_sdl3_opengl3 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib opengl32.lib shell32.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console - -@set OUT_DIR=Release -@REM mkdir %OUT_DIR% -@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_opengl3/build_win64.bat b/examples/example_sdl3_opengl3/build_win64.bat deleted file mode 100644 index 87c6bb8b5..000000000 --- a/examples/example_sdl3_opengl3/build_win64.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler. - -@set OUT_EXE=example_sdl3_opengl3 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x64 SDL3.lib opengl32.lib shell32.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console - -@set OUT_DIR=Release -@REM mkdir %OUT_DIR% -@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_sdlrenderer3/build_win.bat b/examples/example_sdl3_sdlrenderer3/build_win.bat new file mode 100644 index 000000000..86c8bed44 --- /dev/null +++ b/examples/example_sdl3_sdlrenderer3/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl3_sdlrenderer3 +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_sdlrenderer3.cpp ..\..\imgui*.cpp +@set LIBS=SDL3.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_sdlrenderer3/build_win32.bat b/examples/example_sdl3_sdlrenderer3/build_win32.bat deleted file mode 100644 index 7bc131a6a..000000000 --- a/examples/example_sdl3_sdlrenderer3/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_sdl3_sdlrenderer3 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_sdlrenderer3.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 SDL3.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_vulkan/build_win.bat b/examples/example_sdl3_vulkan/build_win.bat new file mode 100644 index 000000000..e1ad37988 --- /dev/null +++ b/examples/example_sdl3_vulkan/build_win.bat @@ -0,0 +1,25 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl3_vulkan +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I %VULKAN_SDK%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp +@set LIBS=SDL3.lib shell32.lib vulkan-1.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console + +@set OUT_DIR=Release +@REM mkdir %OUT_DIR% +@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_vulkan/build_win32.bat b/examples/example_sdl3_vulkan/build_win32.bat deleted file mode 100644 index 3e26d3088..000000000 --- a/examples/example_sdl3_vulkan/build_win32.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. - -@set OUT_EXE=example_sdl3_vulkan -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 SDL3.lib shell32.lib vulkan-1.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console - -@set OUT_DIR=Release -@REM mkdir %OUT_DIR% -@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_vulkan/build_win64.bat b/examples/example_sdl3_vulkan/build_win64.bat deleted file mode 100644 index 5d038d1ee..000000000 --- a/examples/example_sdl3_vulkan/build_win64.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler. - -@set OUT_EXE=example_sdl3_vulkan -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x64 /libpath:%VULKAN_SDK%\lib SDL3.lib shell32.lib vulkan-1.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console - -@set OUT_DIR=Release -@REM mkdir %OUT_DIR% -@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_win32_directx9/build_win.bat b/examples/example_win32_directx9/build_win.bat new file mode 100644 index 000000000..4523769df --- /dev/null +++ b/examples/example_win32_directx9/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_win32_directx9 +@set INCLUDES=/I..\.. /I..\..\backends /I "%DXSDK_DIR%/Include" +@set SOURCES=main.cpp ..\..\backends\imgui_impl_dx9.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp +@set LIBS=d3d9.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:"%DXSDK_DIR%/Lib/x86" +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:"%DXSDK_DIR%/Lib/x64" + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_win32_directx9/build_win32.bat b/examples/example_win32_directx9/build_win32.bat deleted file mode 100644 index ece5ea1ba..000000000 --- a/examples/example_win32_directx9/build_win32.bat +++ /dev/null @@ -1,8 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_win32_directx9 -@set INCLUDES=/I..\.. /I..\..\backends /I "%DXSDK_DIR%/Include" -@set SOURCES=main.cpp ..\..\backends\imgui_impl_dx9.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_win32_vulkan/build_win.bat b/examples/example_win32_vulkan/build_win.bat new file mode 100644 index 000000000..7e71881b3 --- /dev/null +++ b/examples/example_win32_vulkan/build_win.bat @@ -0,0 +1,21 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_win32_vulkan +@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I %VULKAN_SDK%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp +@set LIBS=vulkan-1.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /libpath:%VULKAN_SDK%\lib32 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /libpath:%VULKAN_SDK%\lib + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_win32_vulkan/build_win32.bat b/examples/example_win32_vulkan/build_win32.bat deleted file mode 100644 index 4bfb7cafc..000000000 --- a/examples/example_win32_vulkan/build_win32.bat +++ /dev/null @@ -1,9 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_win32_vulkan -@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp -@set LIBS=/libpath:%VULKAN_SDK%\lib32 vulkan-1.lib - -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% diff --git a/examples/example_win32_vulkan/build_win64.bat b/examples/example_win32_vulkan/build_win64.bat deleted file mode 100644 index f8c66f799..000000000 --- a/examples/example_win32_vulkan/build_win64.bat +++ /dev/null @@ -1,9 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_DIR=Debug -@set OUT_EXE=example_win32_vulkan -@set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp -@set LIBS=/libpath:%VULKAN_SDK%\lib vulkan-1.lib - -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% From 09fe7b19d7b4e99132efe7410872a3c9281ad572 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 23 Oct 2026 16:11:49 +0200 Subject: [PATCH 27/72] Examples: refactored remaining batch files to detect architecture. (Amend) Amend 20ba6c4 --- examples/example_sdl3_sdlgpu3/build_win.bat | 25 +++++++++++++++++++ examples/example_sdl3_sdlgpu3/build_win64.bat | 14 ----------- 2 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 examples/example_sdl3_sdlgpu3/build_win.bat delete mode 100644 examples/example_sdl3_sdlgpu3/build_win64.bat diff --git a/examples/example_sdl3_sdlgpu3/build_win.bat b/examples/example_sdl3_sdlgpu3/build_win.bat new file mode 100644 index 000000000..ff56ee865 --- /dev/null +++ b/examples/example_sdl3_sdlgpu3/build_win.bat @@ -0,0 +1,25 @@ +@REM Build for Visual Studio compiler. First run vcvars32.bat (x86) or vcvars64.bat (x64). + +@REM Detect target architecture (VS 2015 uses Platform, unset for native x86; VS 2017+ uses VSCMD_ARG_TGT_ARCH). +@set TARGET_ARCH=%VSCMD_ARG_TGT_ARCH% +@if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) +@if /I "%TARGET_ARCH%"=="x86" goto arch_ok +@if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). +@exit /b 1 + +:arch_ok +@set OUT_EXE=example_sdl3_sdlgpu3 +@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_sdlgpu3.cpp ..\..\imgui*.cpp +@set LIBS=SDL3.lib shell32.lib +@if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 +@if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 + +@set OUT_DIR=Debug +mkdir %OUT_DIR% +cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console + +@set OUT_DIR=Release +@REM mkdir %OUT_DIR% +@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl3_sdlgpu3/build_win64.bat b/examples/example_sdl3_sdlgpu3/build_win64.bat deleted file mode 100644 index ad7a2d603..000000000 --- a/examples/example_sdl3_sdlgpu3/build_win64.bat +++ /dev/null @@ -1,14 +0,0 @@ -@REM Build for Visual Studio compiler. Run your copy of vcvars64.bat or vcvarsall.bat to setup command-line compiler. - -@set OUT_EXE=example_sdl3_sdlgpu3 -@set INCLUDES=/I..\.. /I..\..\backends /I%SDL3_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl3.cpp ..\..\backends\imgui_impl_sdlgpu3.cpp ..\..\imgui*.cpp -@set LIBS=/LIBPATH:%SDL3_DIR%\lib\x64 SDL3.lib shell32.lib - -@set OUT_DIR=Debug -mkdir %OUT_DIR% -cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console - -@set OUT_DIR=Release -@REM mkdir %OUT_DIR% -@REM cl /nologo /Zi /MD /utf-8 /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console From 4e99c0ab1a28c2b3d1f250ec0266dbf1e455ef58 Mon Sep 17 00:00:00 2001 From: Harish Rajaselvan Date: Fri, 23 Oct 2026 07:37:24 -0700 Subject: [PATCH 28/72] CI: added Windows ARM64 build jobs. Examples: added ARM64 support in build_win.bat files. (#9593) --- .github/workflows/build.yml | 33 +++++++++++++++++++ docs/CHANGELOG.txt | 2 ++ examples/example_sdl3_directx11/build_win.bat | 2 ++ examples/example_sdl3_opengl3/build_win.bat | 2 ++ examples/example_sdl3_sdlgpu3/build_win.bat | 2 ++ .../example_sdl3_sdlrenderer3/build_win.bat | 2 ++ 6 files changed, 43 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa3496d83..5717f5262 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -268,6 +268,39 @@ jobs: shell: cmd run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release' + Build-Windows-ARM64: + runs-on: windows-11-arm + name: Build - Windows ARM64 + + defaults: + run: + working-directory: ${{ github.workspace }}/imgui + + env: + VS_PATH: C:\Program Files\Microsoft Visual Studio\18\Enterprise + steps: + - uses: actions/checkout@v6 + with: + path: ${{ github.workspace }}/imgui + + - name: Build example_null (extra warnings, msvc arm64) + shell: cmd + run: | + cd examples\example_null + call "%VS_PATH%\VC\Auxiliary\Build\vcvarsarm64.bat" + .\build_win.bat /W4 + + - name: Run example_null (msvc arm64) + shell: cmd + run: examples\example_null\Debug\example_null.exe + + - name: Build example_win32_directx11 (msvc arm64) + shell: cmd + run: | + cd examples\example_win32_directx11 + call "%VS_PATH%\VC\Auxiliary\Build\vcvarsarm64.bat" + .\build_win.bat + Build-Linux: runs-on: ubuntu-latest name: Build - Linux diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index fd490de77..724e40f03 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -69,9 +69,11 @@ Other Changes: - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. +- CI: added some ARM64 builds. (#9593) [@Harishmcw] - Examples: renamed various helper batch files from build_win32.bat to build_win.bat to reflect that they can also build X64 or ARM64, given the right environment. Made the script detect the environment when needed (e.g. to specify library path). +- Examples: added support for ARM64 in selected build_win.bat helpers. (#9593) [@Harishmcw] ----------------------------------------------------------------------- diff --git a/examples/example_sdl3_directx11/build_win.bat b/examples/example_sdl3_directx11/build_win.bat index a619de03f..3eccbb2ed 100644 --- a/examples/example_sdl3_directx11/build_win.bat +++ b/examples/example_sdl3_directx11/build_win.bat @@ -5,6 +5,7 @@ @if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) @if /I "%TARGET_ARCH%"=="x86" goto arch_ok @if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@if /I "%TARGET_ARCH%"=="arm64" goto arch_ok @echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). @exit /b 1 @@ -15,6 +16,7 @@ @set LIBS=SDL3.lib d3d11.lib d3dcompiler.lib shell32.lib @if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 @if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 +@if /I "%TARGET_ARCH%"=="arm64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\arm64 @set OUT_DIR=Debug mkdir %OUT_DIR% diff --git a/examples/example_sdl3_opengl3/build_win.bat b/examples/example_sdl3_opengl3/build_win.bat index 0eeef3e0c..6ea3e3941 100644 --- a/examples/example_sdl3_opengl3/build_win.bat +++ b/examples/example_sdl3_opengl3/build_win.bat @@ -5,6 +5,7 @@ @if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) @if /I "%TARGET_ARCH%"=="x86" goto arch_ok @if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@if /I "%TARGET_ARCH%"=="arm64" goto arch_ok @echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). @exit /b 1 @@ -15,6 +16,7 @@ @set LIBS=SDL3.lib opengl32.lib shell32.lib @if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 @if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 +@if /I "%TARGET_ARCH%"=="arm64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\arm64 @set OUT_DIR=Debug mkdir %OUT_DIR% diff --git a/examples/example_sdl3_sdlgpu3/build_win.bat b/examples/example_sdl3_sdlgpu3/build_win.bat index ff56ee865..c71478b57 100644 --- a/examples/example_sdl3_sdlgpu3/build_win.bat +++ b/examples/example_sdl3_sdlgpu3/build_win.bat @@ -5,6 +5,7 @@ @if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) @if /I "%TARGET_ARCH%"=="x86" goto arch_ok @if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@if /I "%TARGET_ARCH%"=="arm64" goto arch_ok @echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). @exit /b 1 @@ -15,6 +16,7 @@ @set LIBS=SDL3.lib shell32.lib @if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 @if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 +@if /I "%TARGET_ARCH%"=="arm64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\arm64 @set OUT_DIR=Debug mkdir %OUT_DIR% diff --git a/examples/example_sdl3_sdlrenderer3/build_win.bat b/examples/example_sdl3_sdlrenderer3/build_win.bat index 86c8bed44..9014d76c2 100644 --- a/examples/example_sdl3_sdlrenderer3/build_win.bat +++ b/examples/example_sdl3_sdlrenderer3/build_win.bat @@ -5,6 +5,7 @@ @if not defined TARGET_ARCH if "%VisualStudioVersion%"=="14.0" (set TARGET_ARCH=x86& if defined Platform set TARGET_ARCH=%Platform%) @if /I "%TARGET_ARCH%"=="x86" goto arch_ok @if /I "%TARGET_ARCH%"=="x64" goto arch_ok +@if /I "%TARGET_ARCH%"=="arm64" goto arch_ok @echo Unsupported or uninitialized compiler environment. First run vcvars32.bat (x86) or vcvars64.bat (x64). @exit /b 1 @@ -15,6 +16,7 @@ @set LIBS=SDL3.lib @if /I "%TARGET_ARCH%"=="x86" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x86 @if /I "%TARGET_ARCH%"=="x64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\x64 +@if /I "%TARGET_ARCH%"=="arm64" set LIBS=%LIBS% /LIBPATH:%SDL3_DIR%\lib\arm64 @set OUT_DIR=Debug mkdir %OUT_DIR% From 717f68fefe31f4ed747aeeba12fa89fcd73ea99d Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 26 Oct 2026 16:34:03 +0100 Subject: [PATCH 29/72] Style: StyleColorsDark(): tweaked WindowBg to be darker than in 1.93.0. --- docs/CHANGELOG.txt | 1 + imgui_draw.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 724e40f03..b0e396e4d 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -66,6 +66,7 @@ Autumn cleanup of stuff marked obsolete more than two years ago: Other Changes: +- Style: `StyleColorsDark()`: tweaked WindowBg to be darker than in 1.93.0. - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui_draw.cpp b/imgui_draw.cpp index f5ea37700..e06a70e98 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -191,7 +191,7 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst) colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.58f, 0.58f, 0.58f, 1.00f); - colors[ImGuiCol_WindowBg] = ImVec4(0.18f, 0.18f, 0.18f, 1.00f); + colors[ImGuiCol_WindowBg] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f); colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); From 4326411672bd57f3496a710b934ebcccabebc320 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 26 Oct 2026 16:01:38 +0100 Subject: [PATCH 30/72] Internals: removed RenderArrowPointingAt(), moved to ColorPicker4 color. --- imgui_draw.cpp | 14 -------------- imgui_internal.h | 2 +- imgui_widgets.cpp | 19 ++++++++++++++----- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index e06a70e98..84bc55832 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -7551,7 +7551,6 @@ begin: // - RenderArrow() // - RenderBullet() // - RenderCheckMark() -// - RenderArrowPointingAt() // - RenderRectFilledInRangeH() // - RenderRectFilledWithHole() //----------------------------------------------------------------------------- @@ -7613,19 +7612,6 @@ void ImGui::RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float draw_list->PathStroke(col, thickness, ImDrawFlags_AALineEnds); } -// Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side. -void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col) -{ - switch (direction) - { - case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return; - case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return; - case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return; - case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return; - case ImGuiDir_None: case ImGuiDir_COUNT: break; // Fix warnings - } -} - static inline float ImAcos01(float x) { if (x <= 0.0f) return IM_PI * 0.5f; diff --git a/imgui_internal.h b/imgui_internal.h index 875c51f42..eaeb52b31 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -549,6 +549,7 @@ inline ImVec2 ImFloor(const ImVec2& v) { return inline float ImTrunc64(float f) { return (float)(ImS64)(f); } inline float ImRoundPositive64(float f) { return (float)(ImS64)(f + 0.5f); } // Positive values only. inline float ImRoundSigned64(float f) { return (float)(ImS64)(f >= 0.0f ? f + 0.5f : f - 0.5f); } +inline ImVec2 ImRoundSigned64(const ImVec2& v) { return ImVec2((float)(ImS64)(v.x >= 0.0f ? v.x + 0.5f : v.x - 0.5f), (float)(ImS64)(v.y >= 0.0f ? v.y + 0.5f : v.y - 0.5f)); } inline float ImCeilFast(float f) { int i = (int)f; return (float)(i + (f > (float)i)); } // Consider using the bit-hack version (search for "0x1p120f"). inline int ImModPositive(int a, int b) { return (a + b) % b; } inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; } @@ -3804,7 +3805,6 @@ namespace ImGui IMGUI_API void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale = 1.0f); IMGUI_API void RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col); 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 RenderRectFilledInRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float fill_x0, float fill_x1, float rounding); IMGUI_API void RenderRectFilledWithHole(ImDrawList* draw_list, const ImRect& outer, const ImRect& inner, ImU32 col, float rounding); IMGUI_API ImDrawFlags CalcRoundingFlagsForRectInRect(const ImRect& r_in, const ImRect& r_outer, float threshold); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 4acdc0a6b..f355df040 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -6176,14 +6176,23 @@ bool ImGui::ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags fl return true; } +// Helper for RenderArrowsForVerticalBar(). 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side. +static void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 p, ImVec2 half_sz, ImGuiDir direction, ImU32 col) +{ + if (direction == ImGuiDir_Left) { draw_list->AddTriangleFilled(ImVec2(p.x + half_sz.x, p.y - half_sz.y), ImVec2(p.x + half_sz.x, p.y + half_sz.y), p, col); } + if (direction == ImGuiDir_Right) { draw_list->AddTriangleFilled(ImVec2(p.x - half_sz.x, p.y + half_sz.y), ImVec2(p.x - half_sz.x, p.y - half_sz.y), p, col); } + //if (direction == ImGuiDir_Up) { draw_list->AddTriangleFilled(ImVec2(p.x + half_sz.x, p.y + half_sz.y), ImVec2(p.x - half_sz.x, p.y + half_sz.y), p, col); } + //if (direction == ImGuiDir_Down){ draw_list->AddTriangleFilled(ImVec2(p.x - half_sz.x, p.y - half_sz.y), ImVec2(p.x + half_sz.x, p.y - half_sz.y), p, col); } +} + // Helper for ColorPicker4() -static void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, float bar_w, float alpha) +static void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 p, ImVec2 half_sz, float bar_w, float alpha) { ImU32 alpha8 = IM_F32_TO_INT8_SAT(alpha); - ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Right, IM_COL32(0,0,0,alpha8)); - ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, ImGuiDir_Right, IM_COL32(255,255,255,alpha8)); - ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Left, IM_COL32(0,0,0,alpha8)); - ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, ImGuiDir_Left, IM_COL32(255,255,255,alpha8)); + RenderArrowPointingAt(draw_list, ImVec2(p.x + half_sz.x + 1, p.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Right, IM_COL32(0,0,0,alpha8)); + RenderArrowPointingAt(draw_list, ImVec2(p.x + half_sz.x, p.y), half_sz, ImGuiDir_Right, IM_COL32(255,255,255,alpha8)); + RenderArrowPointingAt(draw_list, ImVec2(p.x + bar_w - half_sz.x - 1, p.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Left, IM_COL32(0,0,0,alpha8)); + RenderArrowPointingAt(draw_list, ImVec2(p.x + bar_w - half_sz.x, p.y), half_sz, ImGuiDir_Left, IM_COL32(255,255,255,alpha8)); } // Note: ColorPicker4() only accesses 3 floats if ImGuiColorEditFlags_NoAlpha flag is set. From 726399ff76990f5c71290613c80cb6ba97bb658c Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 26 Oct 2026 16:47:08 +0100 Subject: [PATCH 31/72] Internals: RenderArrow: apply scale to horizontal offset. (#3895) In the absence of a better standardized symbol/icon design this seem more consistent. --- imgui_draw.cpp | 2 +- imgui_tables.cpp | 2 +- imgui_widgets.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 84bc55832..1b9af8822 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -7563,7 +7563,7 @@ void ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir d { const float h = draw_list->_Data->FontSize * 1.00f; float r = h * 0.40f * scale; - ImVec2 center = pos + ImVec2(h * 0.50f, h * 0.50f * scale); + ImVec2 center = pos + ImVec2(h * 0.50f * scale, h * 0.50f * scale); ImVec2 a, b, c; switch (dir) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index ee208d160..e82c71dfb 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -3435,7 +3435,7 @@ void ImGui::TableHeader(const char* label) PopStyleColor(); x += w_sort_text; } - RenderArrow(window->DrawList, ImVec2(x, y), GetColorU32(ImGuiCol_Text), column->SortDirection == ImGuiSortDirection_Ascending ? ImGuiDir_Up : ImGuiDir_Down, ARROW_SCALE); + RenderArrow(window->DrawList, ImVec2(x + (g.FontSize * (1.0f - ARROW_SCALE) * 0.5f) , y), GetColorU32(ImGuiCol_Text), column->SortDirection == ImGuiSortDirection_Ascending ? ImGuiDir_Up : ImGuiDir_Down, ARROW_SCALE); } // Handle clicking on column header to adjust Sort Order diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index f355df040..3a0259c71 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7281,7 +7281,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l if (flags & ImGuiTreeNodeFlags_Bullet) RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.5f, text_pos.y + g.FontSize * 0.5f), text_col); else if (!is_leaf) - RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ((flags & ImGuiTreeNodeFlags_UpsideDownArrow) ? ImGuiDir_Up : ImGuiDir_Down) : ImGuiDir_Right, 0.70f); + RenderArrow(window->DrawList, ImVec2(text_pos.x + g.FontSize * 0.15f - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ((flags & ImGuiTreeNodeFlags_UpsideDownArrow) ? ImGuiDir_Up : ImGuiDir_Down) : ImGuiDir_Right, 0.70f); if (g.LogEnabled) LogSetNextTextDecoration(">", NULL); } From 048d7e10b5bcc48e20850694d693fbad71c799b5 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 27 Oct 2026 13:02:28 +0100 Subject: [PATCH 32/72] Style: made default arrow stroked. Added SymbolArrowSizeFactor, SymbolArrowThicknessFactor to style arrow. (#5233, #2431, #2235, #6730, #8243) Internal function takes a angle: #5812. This doesn't cover generic rendering override for symbols: #8243, #2431 (arrows, somehow less needed now), #3351 (checkmarks), #6730 (tree nodes) --- docs/CHANGELOG.txt | 4 +++ imgui.cpp | 4 +++ imgui.h | 4 +++ imgui_demo.cpp | 4 +++ imgui_draw.cpp | 67 +++++++++++++++++++++++++++------------------- imgui_internal.h | 1 + 6 files changed, 56 insertions(+), 28 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index b0e396e4d..2cb513c3b 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -67,6 +67,10 @@ Autumn cleanup of stuff marked obsolete more than two years ago: Other Changes: - Style: `StyleColorsDark()`: tweaked WindowBg to be darker than in 1.93.0. +- Style: added `style.SymbolArrowSizeFactor`, `style.SymbolArrowThicknessFactor` to tweak + the shape and look of arrows. Made default arrow stroked. (#5233, #2431, #2235, #6730, #8243) + Legacy arrow: size: (0.60f,0.70f), thickness: 0.0f + New arrow: size: (0.72f,0.40f), thickness: 0.30f - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui.cpp b/imgui.cpp index 585e8a9b2..f8a2def00 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1628,6 +1628,10 @@ ImGuiStyle::ImGuiStyle() DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. + // Symbols + SymbolArrowSizeFactor = ImVec2(0.72f,0.40f); // Width/height factor of arrows (0.0f..1.0f). Legacy arrows use (0.60f,0.70f) + SymbolArrowThicknessFactor = 0.30f; // Thickness factor of arrows (0.0f..0.5f). 0.0f=Fill. >0.0f=Stroke. Legacy arrows use 0.0f. + // Rendering & Tessellation AntiAliasedLines = true; // Enable anti-aliased lines/borders. Used at the beginning of the frame to set ImDrawFlags_AALines in all draw-lists. AntiAliasedLineEnds = false; // Enable anti-aliased lines/borders ends. Nicer for thick lines but more expensive. Used at the beginning of the frame to set ImDrawFlags_AALineEnds in all draw-lists. diff --git a/imgui.h b/imgui.h index fdbcf80ba..67e11d18c 100644 --- a/imgui.h +++ b/imgui.h @@ -2396,6 +2396,10 @@ struct ImGuiStyle ImVec2 DisplaySafeAreaPadding; // Apply to every windows, menus, popups, tooltips: amount where we avoid displaying contents. Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured). float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later. + // Symbols + ImVec2 SymbolArrowSizeFactor; // Width/height factor of arrows (0.0f..1.0f). + float SymbolArrowThicknessFactor; // Thickness factor of arrows (0.0f..0.5f). 0.0f=Fill. >0.0f=Stroke. + // Rendering & Tessellation bool AntiAliasedLines; // Enable anti-aliased lines/borders. Used at the beginning of the frame to set ImDrawFlags_AALines in all draw-lists. bool AntiAliasedLineEnds; // Enable anti-aliased lines/borders ends. Nicer for thick lines but more expensive. Used at the beginning of the frame to set ImDrawFlags_AALineEnds in all draw-lists. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index ede2eeb07..aeb896305 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -8807,6 +8807,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) SliderFloat("ImageRounding", &style.ImageRounding, 0.0f, 12.0f, "%.0f"); SliderFloat("ImageBorderSize", &style.ImageBorderSize, 0.0f, max_border_size, "%.0f"); + SeparatorText("Symbols"); + DragFloat2("SymbolArrowSizeFactor", &style.SymbolArrowSizeFactor.x, 0.01f, 0.0f, 1.0f); + DragFloat("SymbolArrowThicknessFactor", &style.SymbolArrowThicknessFactor, 0.01f, 0.0f, 0.5f); + SeparatorText("Tooltips"); for (int n = 0; n < 2; n++) if (TreeNodeEx(n == 0 ? "HoverFlagsForTooltipMouse" : "HoverFlagsForTooltipNav")) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 1b9af8822..6ab6c6c45 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -7558,36 +7558,47 @@ begin: // - RenderColorRectWithAlphaCheckerboard() //----------------------------------------------------------------------------- -// Render an arrow aimed to be aligned with text (p_min is a position in the same space text would be positioned). To e.g. denote expanded/collapsed state +static const ImVec2 g_ImGuiDirCosSin[4] = { { -1.0f, 0.0f }, { +1.0f, 0.0f }, { 0.0f, -1.0f }, { 0.0f, +1.0f } }; + +// arrow_h, arrow_w, arrow_th are normalized: 0.0f..1.0f +// arrow_th: 0.0f == fill, >0.0f == stroke weight. +void ImGui::RenderArrowEx(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float cos_a, float sin_a, float scale, ImVec2 arrow_sizes, float arrow_th) +{ + const bool is_fill = (arrow_th <= 0.0f); + const float r = draw_list->_Data->FontSize * 0.50f * scale; + const float thickness = is_fill ? 0.0f : IM_ROUND(ImClamp(r * arrow_th, 1.0f, r * 0.5f)); + + // Bias for shape to feel more centered + const float bias = is_fill ? (r * 0.05f) : (thickness * 0.8f * 0.7071f); + const ImVec2 center = ImVec2(pos.x + r + bias * cos_a, pos.y + r + bias * sin_a); + + const float arrow_h = arrow_sizes.y * r; + const float arrow_w = arrow_sizes.x * r; + ImVec2 p[3]; + p[0] = ImVec2(center.x - arrow_h * cos_a - arrow_w * -sin_a, center.y - arrow_h * sin_a - arrow_w * cos_a); + p[1] = ImVec2(center.x + arrow_h * cos_a, center.y + arrow_h * sin_a); + p[2] = ImVec2(center.x - arrow_h * cos_a + arrow_w * -sin_a, center.y - arrow_h * sin_a + arrow_w * cos_a); + + // Pixel align when at a right angle + if (is_fill && (cos_a * sin_a >= -FLT_EPSILON) && (cos_a * sin_a <= FLT_EPSILON)) + { + p[0] = ImRoundSigned64(p[0]); + p[1] = ImRoundSigned64(p[1]); + p[2] = ImRoundSigned64(p[2]); + } + + if (is_fill) + draw_list->AddConvexPolyFilled(p, 3, col); + else + draw_list->_AddPolyline(p, 3, col, thickness, ImDrawFlags_StrokeInside | ImDrawFlags_AALineEnds, FLT_MAX); // FIXME-OPT: baked filled shape? +} + +// Render an arrow aimed to be aligned with text. void ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale) { - const float h = draw_list->_Data->FontSize * 1.00f; - float r = h * 0.40f * scale; - ImVec2 center = pos + ImVec2(h * 0.50f * scale, h * 0.50f * scale); - - ImVec2 a, b, c; - switch (dir) - { - case ImGuiDir_Up: - case ImGuiDir_Down: - if (dir == ImGuiDir_Up) r = -r; - a = ImVec2(+0.000f, +0.750f) * r; - b = ImVec2(-0.866f, -0.750f) * r; - c = ImVec2(+0.866f, -0.750f) * r; - break; - case ImGuiDir_Left: - case ImGuiDir_Right: - if (dir == ImGuiDir_Left) r = -r; - a = ImVec2(+0.750f, +0.000f) * r; - b = ImVec2(-0.750f, +0.866f) * r; - c = ImVec2(-0.750f, -0.866f) * r; - break; - case ImGuiDir_None: - case ImGuiDir_COUNT: - IM_ASSERT(0); - break; - } - draw_list->AddTriangleFilled(center + a, center + b, center + c, col); + ImGuiContext& g = *GImGui; + ImVec2 cos_sin = g_ImGuiDirCosSin[dir]; + RenderArrowEx(draw_list, pos, col, cos_sin.x, cos_sin.y, scale, g.Style.SymbolArrowSizeFactor, g.Style.SymbolArrowThicknessFactor); } void ImGui::RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col) diff --git a/imgui_internal.h b/imgui_internal.h index eaeb52b31..9cc49e343 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -3803,6 +3803,7 @@ namespace ImGui // Render helpers (those functions don't access any ImGui state!) IMGUI_API void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale = 1.0f); + IMGUI_API void RenderArrowEx(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float cos_a, float sin_a, float scale, ImVec2 arrow_sizes, float arrow_th); IMGUI_API void RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col); IMGUI_API void RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz); IMGUI_API void RenderRectFilledInRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float fill_x0, float fill_x1, float rounding); From 2f1552d4d58b8b443d70e27edddb92a3c3f68641 Mon Sep 17 00:00:00 2001 From: Yaki Blake Date: Tue, 27 Oct 2026 15:20:31 +0100 Subject: [PATCH 33/72] TreeNodeGetOpen(): added flags parameter. (#9569, #9592, #3823, #9251) --- docs/CHANGELOG.txt | 3 +++ imgui.h | 2 +- imgui_widgets.cpp | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 2cb513c3b..05604c48b 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -71,6 +71,9 @@ Other Changes: the shape and look of arrows. Made default arrow stroked. (#5233, #2431, #2235, #6730, #8243) Legacy arrow: size: (0.60f,0.70f), thickness: 0.0f New arrow: size: (0.72f,0.40f), thickness: 0.30f +- TreeNode: + - TreeNodeGetOpen(): added flags parameter to allow passing `ImGuiTreeNodeFlags_DefaultOpen` + or `ImGuiTreeNodeFlags_Leaf`. (#9569, #9592, #3823, #9251) [@adalisk-emikhaylov, @Yaki-Blake] - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui.h b/imgui.h index 67e11d18c..04c25c98e 100644 --- a/imgui.h +++ b/imgui.h @@ -769,7 +769,7 @@ namespace ImGui IMGUI_API bool CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFlags flags = 0); // when 'p_visible != NULL': if '*p_visible==true' display an additional small close button on upper right of the header which will set the bool to false when clicked, if '*p_visible==false' don't display the header. IMGUI_API void SetNextItemOpen(bool is_open, ImGuiCond cond = 0); // set next TreeNode/CollapsingHeader open state. IMGUI_API void SetNextItemStorageID(ImGuiID storage_id); // set id to use for open/close storage (default to same as item id). - IMGUI_API bool TreeNodeGetOpen(ImGuiID storage_id); // retrieve tree node open/close state. + IMGUI_API bool TreeNodeGetOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags = 0); // retrieve tree node open/close state. // Widgets: Selectables // - A selectable highlights when hovered, and can display another color when selected. diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 3a0259c71..7acda6ce4 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -6931,13 +6931,15 @@ bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char return TreeNodeBehavior(id, flags, label, label_end); } -// The reason those two functions are not yet in public API is because I would like to design a more feature-full and generic API for this. -// They are otherwise function (cc: #3823, #9251, #7553, #6754, #5423, #2958, #2079, #1947, #1131, #722) -bool ImGui::TreeNodeGetOpen(ImGuiID storage_id) +// I would like to design a more feature-full and generic API for this. +// (cc: #3823, #9251, #7553, #6754, #5423, #2958, #2079, #1947, #1131, #722, #9569) +bool ImGui::TreeNodeGetOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags) { + if (flags & ImGuiTreeNodeFlags_Leaf) + return true; ImGuiContext& g = *GImGui; ImGuiStorage* storage = g.CurrentWindow->DC.StateStorage; - return storage->GetInt(storage_id, 0) != 0; + return storage->GetInt(storage_id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0; } void ImGui::TreeNodeSetOpen(ImGuiID storage_id, bool is_open) From 86b853ae8aacb6e1bc419ef402101bb01b5ebd57 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 27 Oct 2026 15:43:57 +0100 Subject: [PATCH 34/72] TabBar: rename VisibleTabId->VisibleTabContentsId for clarify and correctness. Toward #9581 --- imgui_internal.h | 4 ++-- imgui_widgets.cpp | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/imgui_internal.h b/imgui_internal.h index 9cc49e343..6e73dd3f5 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2936,7 +2936,7 @@ struct ImGuiTabItem { ImGuiID ID; ImGuiTabItemFlags Flags; - int LastFrameVisible; + int LastFrameVisible; // TabItem visibility (not contents visibility) int LastFrameSelected; // This allows us to infer an ordered list of the last activated tabs with little maintenance float Offset; // Position relative to beginning of tab bar float Width; // Width currently displayed @@ -2960,7 +2960,7 @@ struct IMGUI_API ImGuiTabBar ImGuiID SelectedTabId; // Selected tab/window ImGuiID NextSelectedTabId; // Next selected tab/window. Will also trigger a scrolling animation ImGuiID NextScrollToTabId; - ImGuiID VisibleTabId; // Can occasionally be != SelectedTabId (e.g. when previewing contents for Ctrl+Tab preview) + ImGuiID VisibleTabContentsId; // Can occasionally be != SelectedTabId (e.g. when previewing contents for Ctrl+Tab preview) int CurrFrameVisible; int PrevFrameVisible; ImRect BarRect; diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 7acda6ce4..40ee343a0 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -10069,7 +10069,7 @@ void ImGui::EndTabBar() // Restore the last visible height if no tab is visible, this reduce vertical flicker/movement when a tabs gets removed without calling SetTabItemClosed(). const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount); - if (tab_bar->VisibleTabWasSubmitted || tab_bar->VisibleTabId == 0 || tab_bar_appearing) + if (tab_bar->VisibleTabWasSubmitted || tab_bar->VisibleTabContentsId == 0 || tab_bar_appearing) { tab_bar->CurrTabsContentsHeight = ImMax(window->DC.CursorPos.y - tab_bar->BarRect.Max.y, tab_bar->CurrTabsContentsHeight); window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->CurrTabsContentsHeight; @@ -10117,7 +10117,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) if (tab->LastFrameVisible < tab_bar->PrevFrameVisible || tab->WantClose) { // Remove tab - if (tab_bar->VisibleTabId == tab->ID) { tab_bar->VisibleTabId = 0; } + if (tab_bar->VisibleTabContentsId == tab->ID) { tab_bar->VisibleTabContentsId = 0; } if (tab_bar->SelectedTabId == tab->ID) { tab_bar->SelectedTabId = 0; } if (tab_bar->NextSelectedTabId == tab->ID) { tab_bar->NextSelectedTabId = 0; } continue; @@ -10322,7 +10322,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) scroll_to_tab_id = tab_bar->SelectedTabId = most_recently_selected_tab->ID; // Lock in visible tab - tab_bar->VisibleTabId = tab_bar->SelectedTabId; + tab_bar->VisibleTabContentsId = tab_bar->SelectedTabId; tab_bar->VisibleTabWasSubmitted = false; // Apply request requests @@ -10436,9 +10436,9 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id) { if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id)) tab_bar->Tabs.erase(tab); - if (tab_bar->VisibleTabId == tab_id) { tab_bar->VisibleTabId = 0; } - if (tab_bar->SelectedTabId == tab_id) { tab_bar->SelectedTabId = 0; } - if (tab_bar->NextSelectedTabId == tab_id) { tab_bar->NextSelectedTabId = 0; } + if (tab_bar->VisibleTabContentsId == tab_id){ tab_bar->VisibleTabContentsId = 0; } + if (tab_bar->SelectedTabId == tab_id) { tab_bar->SelectedTabId = 0; } + if (tab_bar->NextSelectedTabId == tab_id) { tab_bar->NextSelectedTabId = 0; } } // Called on manual closure attempt @@ -10452,7 +10452,7 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) // This will remove a frame of lag for selecting another tab on closure. // However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure tab->WantClose = true; - if (tab_bar->VisibleTabId == tab->ID) + if (tab_bar->VisibleTabContentsId == tab->ID) { tab->LastFrameVisible = -1; tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0; @@ -10461,7 +10461,7 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) else { // Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup) - if (tab_bar->VisibleTabId != tab->ID) + if (tab_bar->VisibleTabContentsId != tab->ID) TabBarQueueFocus(tab_bar, tab); } } @@ -10865,7 +10865,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // Lock visibility // (Note: tab_contents_visible != tab_selected... because Ctrl+Tab operations may preview some tabs without selecting them!) - bool tab_contents_visible = (tab_bar->VisibleTabId == id); + bool tab_contents_visible = (tab_bar->VisibleTabContentsId == id); if (tab_contents_visible) tab_bar->VisibleTabWasSubmitted = true; @@ -10878,6 +10878,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'. if (tab_appearing && (!tab_bar_appearing || tab_is_new)) { + // This path doesn't render the tab. ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav); if (is_tab_button) return false; From 50ae760fcee04ba93e94539523e9a060beeb5b69 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 27 Oct 2026 15:50:22 +0100 Subject: [PATCH 35/72] TabBar: Internals: add tab_bar->VisibleTabContentsJustAppeared. (#9581) --- imgui_internal.h | 2 ++ imgui_widgets.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/imgui_internal.h b/imgui_internal.h index 6e73dd3f5..69acf63eb 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2946,6 +2946,7 @@ struct ImGuiTabItem ImS16 BeginOrder; // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable ImS16 IndexDuringLayout; // Index only used during TabBarLayout(). Tabs gets reordered so 'Tabs[n].IndexDuringLayout == n' but may mismatch during additions. bool WantClose; // Marked as closed by SetTabItemClosed() + bool ContentsIsVisible; ImGuiTabItem() { memset((void*)this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; } }; @@ -2982,6 +2983,7 @@ struct IMGUI_API ImGuiTabBar ImS8 BeginCount; bool WantLayout; bool VisibleTabWasSubmitted; + bool VisibleTabContentsJustAppeared; bool TabsAddedNew; // Set to true when a new tab item or button has been added to the tab bar during last frame bool ScrollButtonEnabled; ImS16 TabsActiveCount; // Number of tabs submitted this frame. diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 40ee343a0..22ffe8de5 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -10323,7 +10323,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) // Lock in visible tab tab_bar->VisibleTabContentsId = tab_bar->SelectedTabId; - tab_bar->VisibleTabWasSubmitted = false; + tab_bar->VisibleTabWasSubmitted = tab_bar->VisibleTabContentsJustAppeared = false; // Apply request requests if (scroll_to_tab_id != 0) @@ -10866,14 +10866,19 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // Lock visibility // (Note: tab_contents_visible != tab_selected... because Ctrl+Tab operations may preview some tabs without selecting them!) bool tab_contents_visible = (tab_bar->VisibleTabContentsId == id); - if (tab_contents_visible) - tab_bar->VisibleTabWasSubmitted = true; // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches if (!tab_contents_visible && tab_bar->SelectedTabId == 0 && tab_bar_appearing) if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs)) tab_contents_visible = true; + if (tab_contents_visible) + { + tab_bar->VisibleTabWasSubmitted = true; + tab_bar->VisibleTabContentsJustAppeared = tab_contents_visible && !tab->ContentsIsVisible; + } + tab->ContentsIsVisible = tab_contents_visible; + // Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted // and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'. if (tab_appearing && (!tab_bar_appearing || tab_is_new)) From 1069a952e026f2640462ec6a5156c31d6b3f4030 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 27 Oct 2026 16:27:10 +0100 Subject: [PATCH 36/72] TabBar: Internals: added TabItemIsContentsAppearing() and reworked 50ae760. (#9581) --- imgui_internal.h | 3 ++- imgui_widgets.cpp | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/imgui_internal.h b/imgui_internal.h index 69acf63eb..16743905c 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2983,7 +2983,7 @@ struct IMGUI_API ImGuiTabBar ImS8 BeginCount; bool WantLayout; bool VisibleTabWasSubmitted; - bool VisibleTabContentsJustAppeared; + bool LastTabItemContentsAppearing; bool TabsAddedNew; // Set to true when a new tab item or button has been added to the tab bar during last frame bool ScrollButtonEnabled; ImS16 TabsActiveCount; // Number of tabs submitted this frame. @@ -3778,6 +3778,7 @@ namespace ImGui IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, ImVec2 mouse_pos); IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar); IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window); + IMGUI_API bool TabItemIsContentsAppearing(); IMGUI_API void TabItemSpacing(const char* str_id, ImGuiTabItemFlags flags, float width); IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker); IMGUI_API ImVec2 TabItemCalcSize(ImGuiWindow* window); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 22ffe8de5..ea5871a51 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -10323,7 +10323,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) // Lock in visible tab tab_bar->VisibleTabContentsId = tab_bar->SelectedTabId; - tab_bar->VisibleTabWasSubmitted = tab_bar->VisibleTabContentsJustAppeared = false; + tab_bar->VisibleTabWasSubmitted = tab_bar->LastTabItemContentsAppearing = false; // Apply request requests if (scroll_to_tab_id != 0) @@ -10752,6 +10752,12 @@ void ImGui::EndTabItem() PopID(); } +bool ImGui::TabItemIsContentsAppearing() +{ + ImGuiContext& g = *GImGui; + return g.CurrentTabBar->LastTabItemContentsAppearing; +} + bool ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags) { ImGuiContext& g = *GImGui; @@ -10863,20 +10869,17 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, TabBarQueueFocus(tab_bar, tab); } + // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches + if (tab_bar->VisibleTabContentsId == 0 && tab_bar->SelectedTabId == 0 && tab_bar_appearing) + if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs)) + tab_bar->VisibleTabContentsId = id; + // Lock visibility // (Note: tab_contents_visible != tab_selected... because Ctrl+Tab operations may preview some tabs without selecting them!) - bool tab_contents_visible = (tab_bar->VisibleTabContentsId == id); - - // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches - if (!tab_contents_visible && tab_bar->SelectedTabId == 0 && tab_bar_appearing) - if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs)) - tab_contents_visible = true; - + const bool tab_contents_visible = (tab_bar->VisibleTabContentsId == id); if (tab_contents_visible) - { tab_bar->VisibleTabWasSubmitted = true; - tab_bar->VisibleTabContentsJustAppeared = tab_contents_visible && !tab->ContentsIsVisible; - } + tab_bar->LastTabItemContentsAppearing = tab_contents_visible && !tab->ContentsIsVisible; tab->ContentsIsVisible = tab_contents_visible; // Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted From 80d572ce359e2a9ca0c4386ab9cf220d5c15ce0f Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 27 Oct 2026 18:10:59 +0100 Subject: [PATCH 37/72] TreeNode: minor tidying up. (should have no side-effect) --- imgui_demo.cpp | 1 + imgui_widgets.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index aeb896305..550e0d8da 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -4430,6 +4430,7 @@ static void DemoWindowWidgetsTreeNodes() ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Framed", &base_flags, ImGuiTreeNodeFlags_Framed); ImGui::SameLine(); HelpMarker("Draw frame with background (e.g. for CollapsingHeader)"); ImGui::CheckboxFlags("ImGuiTreeNodeFlags_FramePadding", &base_flags, ImGuiTreeNodeFlags_FramePadding); ImGui::CheckboxFlags("ImGuiTreeNodeFlags_NavLeftJumpsToParent", &base_flags, ImGuiTreeNodeFlags_NavLeftJumpsToParent); + ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Bullet", &base_flags, ImGuiTreeNodeFlags_Bullet); HelpMarker("Default option for DrawLinesXXX is stored in style.TreeLinesFlags"); ImGui::CheckboxFlags("ImGuiTreeNodeFlags_DrawLinesNone", &base_flags, ImGuiTreeNodeFlags_DrawLinesNone); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index ea5871a51..e1a884429 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7041,9 +7041,10 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l label_end = FindRenderedTextEnd(label); const ImVec2 label_size = CalcTextSize(label, label_end, false); - const float text_offset_x = g.FontSize + (display_frame ? padding.x * 3 : padding.x * 2); // Collapsing arrow width + Spacing + const float icon_width = g.FontSize + padding.x * 2; + const float text_offset_x = display_frame ? icon_width + padding.x : icon_width; // Collapsing arrow width + Spacing const float text_offset_y = use_frame_padding ? ImMax(style.FramePadding.y, window->DC.CurrLineTextBaseOffset) : window->DC.CurrLineTextBaseOffset; // Latch before ItemSize changes it - const float text_width = g.FontSize + label_size.x + padding.x * 2; // Include collapsing arrow + const float text_width = icon_width + label_size.x; // Include collapsing arrow const float frame_height = label_size.y + padding.y * 2; const bool span_all_columns = (flags & ImGuiTreeNodeFlags_SpanAllColumns) != 0 && (g.CurrentTable != NULL); @@ -7076,6 +7077,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l if (span_all_columns || span_all_columns_label) { // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable.. + // FIXME: Investigate moving this to an item flag, along duplicate code in Selectable(). How to do optimally? const float backup_clip_rect_min_x = window->ClipRect.Min.x; const float backup_clip_rect_max_x = window->ClipRect.Max.x; window->ClipRect.Min.x = window->ParentWorkRect.Min.x; From 2fb554b1c81e6a8efcb4e3c236649a46354aa9ba Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 28 Oct 2026 15:41:13 +0100 Subject: [PATCH 38/72] Modals: fixed an assert displaying a modal in an environment where io.DisplayFramebufferScale is not an integer. (#9598) --- docs/CHANGELOG.txt | 10 +++++++--- imgui.cpp | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 05604c48b..ec2cc0763 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -66,14 +66,18 @@ Autumn cleanup of stuff marked obsolete more than two years ago: Other Changes: -- Style: `StyleColorsDark()`: tweaked WindowBg to be darker than in 1.93.0. -- Style: added `style.SymbolArrowSizeFactor`, `style.SymbolArrowThicknessFactor` to tweak - the shape and look of arrows. Made default arrow stroked. (#5233, #2431, #2235, #6730, #8243) +- Style: + - `StyleColorsDark()`: tweaked WindowBg to be darker than in 1.93.0. + - Added `style.SymbolArrowSizeFactor`, `style.SymbolArrowThicknessFactor` to tweak the + shape and look of arrows. Made default arrow stroked. (#5233, #2431, #2235, #6730, #8243) Legacy arrow: size: (0.60f,0.70f), thickness: 0.0f New arrow: size: (0.72f,0.40f), thickness: 0.30f - TreeNode: - TreeNodeGetOpen(): added flags parameter to allow passing `ImGuiTreeNodeFlags_DefaultOpen` or `ImGuiTreeNodeFlags_Leaf`. (#9569, #9592, #3823, #9251) [@adalisk-emikhaylov, @Yaki-Blake] +- Popups: + - Modals: fixed an assert displaying a modal in an environment where + `io.DisplayFramebufferScale` is not an integer (regression in 1.93.0). (#9598) - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui.cpp b/imgui.cpp index f8a2def00..67edfa37b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6122,7 +6122,8 @@ static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 if (draw_list->CmdBuffer.Size == 0) draw_list->AddDrawCmd(); draw_list->PushClipRect(viewport_rect.Min - ImVec2(1, 1), viewport_rect.Max + ImVec2(1, 1), false); // FIXME: Need to strictly ensure ImDrawCmd are not merged (ElemCount==6 checks below will verify that) - draw_list->AddRectFilled(viewport_rect.Min, viewport_rect.Max, col); + draw_list->PrimReserve(6, 4); + draw_list->PrimRect(viewport_rect.Min, viewport_rect.Max, col); ImDrawCmd cmd = draw_list->CmdBuffer.back(); IM_ASSERT(cmd.ElemCount == 6); draw_list->CmdBuffer.pop_back(); From b87728bd2b2bdaa63efa13f390adb73ed3c40afd Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Oct 2026 13:47:01 +0100 Subject: [PATCH 39/72] Tables: clamp vertical border Y2 position when not using scrolling table, so that ImDrawCmd AABB stays reasonable. This does not fix any screen visible issue, and should not be noticeable if correct. (context: investigated this while looking at #4678, but not actually directly related) --- docs/CHANGELOG.txt | 3 +++ imgui.h | 2 +- imgui_tables.cpp | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index ec2cc0763..d0704cac1 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -78,6 +78,9 @@ Other Changes: - Popups: - Modals: fixed an assert displaying a modal in an environment where `io.DisplayFramebufferScale` is not an integer (regression in 1.93.0). (#9598) +- Tables: + - In non-scrolling tables, clamp lower border coordinates to stay within visible + range (no visible changes, but ImDrawCmd AABB becomes more sensible). - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui.h b/imgui.h index 04c25c98e..9a2313a59 100644 --- a/imgui.h +++ b/imgui.h @@ -30,7 +30,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') #define IMGUI_VERSION "1.93.1 WIP" -#define IMGUI_VERSION_NUM 19301 +#define IMGUI_VERSION_NUM 19302 #define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000 #define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198 diff --git a/imgui_tables.cpp b/imgui_tables.cpp index e82c71dfb..a303760a0 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -2951,19 +2951,24 @@ static ImU32 TableGetColumnBorderCol(ImGuiTable* table, int order_n, int column_ void ImGui::TableDrawBorders(ImGuiTable* table) { ImGuiWindow* inner_window = table->InnerWindow; - if (!table->OuterWindow->ClipRect.Overlaps(table->OuterRect)) + if (!table->OuterWindow->ClipRect.Overlaps(table->OuterRect)) // Note how OuterWindow->ClipRect == table->Bg0ClipRectForDrawCmd return; ImDrawList* inner_drawlist = inner_window->DrawList; table->DrawSplitter->SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0); - inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false); + inner_drawlist->PushClipRect(table->OuterWindow->ClipRect.Min, table->OuterWindow->ClipRect.Max, false); + + const float border_size = TABLE_BORDER_SIZE; + + // For e.g. non scrolling table we limit vertex coordinates in order to keep ImDrawCmd AABB roughly within visible range. + const float draw_y2_limit = table->OuterWindow->ClipRect.Max.y + (2.0f * ImMax(border_size, inner_drawlist->_FringeScale)); // Draw inner border and resizing feedback ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); - const float border_size = TABLE_BORDER_SIZE; const float draw_y1 = ImMax(table->InnerRect.Min.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->AngledHeadersHeight) + ((table->Flags & ImGuiTableFlags_BordersOuterH) ? border_size : 0.0f); - const float draw_y2_body = table->InnerRect.Max.y; - const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table_instance->LastTopHeadersRowHeight) : draw_y1; + const float draw_y2_body = ImMin(table->InnerRect.Max.y, draw_y2_limit); + const float draw_y2_head = table->IsUsingHeaders ? ImMin(draw_y2_body, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table_instance->LastTopHeadersRowHeight) : draw_y1; + if (table->Flags & ImGuiTableFlags_BordersInnerV) { for (int order_n = 0; order_n < table->ColumnsCount; order_n++) @@ -3009,7 +3014,8 @@ void ImGui::TableDrawBorders(ImGuiTable* table) // parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part // of it in inner window, and the part that's over scrollbars in the outer window..) // Either solution currently won't allow us to use a larger border size: the border would clipped. - const ImRect outer_border = table->OuterRect; + ImRect outer_border = table->OuterRect; + outer_border.Max.y = ImMin(outer_border.Max.y, draw_y2_limit); // Clamp but keep bottom border non-visible. const ImU32 outer_col = table->BorderColorStrong; if ((table->Flags & ImGuiTableFlags_BordersOuter) == ImGuiTableFlags_BordersOuter) { From d2ba763635a958fc5cbdab6139ffa739a7048722 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Oct 2026 18:29:27 +0100 Subject: [PATCH 40/72] Tables: fixed various issues with using ImGuiTableFlags_NoHostExtendY. --- docs/CHANGELOG.txt | 4 ++++ imgui_demo.cpp | 1 + imgui_tables.cpp | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index d0704cac1..fbd0a60f9 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -81,6 +81,10 @@ Other Changes: - Tables: - In non-scrolling tables, clamp lower border coordinates to stay within visible range (no visible changes, but ImDrawCmd AABB becomes more sensible). + - Fixed various issues with using `ImGuiTableFlags_NoHostExtendY`: + - Fixed selectable highlight straying off the Y2 clipping limit. + - Fixed parent window work rectangle affecting the Y2 clipping limit. + - Fixed the Y2 clipping limit overlapping bottom outer border. - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 550e0d8da..547661f7d 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -6954,6 +6954,7 @@ static void DemoWindowTables() if (ImGui::TreeNode("Outer size")) { IMGUI_DEMO_MARKER("Tables/Outer size"); + // Showcasing use of ImGuiTableFlags_NoHostExtendX and ImGuiTableFlags_NoHostExtendY // Important to that note how the two flags have slightly different behaviors! ImGui::Text("Using NoHostExtendX and NoHostExtendY:"); diff --git a/imgui_tables.cpp b/imgui_tables.cpp index a303760a0..0c0796384 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -482,12 +482,12 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG // (we normally shouldn't alter HostClipRect as we rely on TableMergeDrawChannels() expanding non-clipped column toward the // limits of that rectangle, in order for ImDrawListSplitter::Merge() to merge the draw commands. However since the overlap // problem only affect scrolling tables in this case we can get away with doing it without extra cost). + const float border_size = TABLE_BORDER_SIZE; if (inner_window != outer_window) { // FIXME: Because inner_window's Scrollbar doesn't know about border size, since it's not encoded in window->WindowBorderSize, // it already overlaps it and doesn't need an extra offset. Ideally we should be able to pass custom border size with // different x/y values to BeginChild(). - const float border_size = TABLE_BORDER_SIZE; if (flags & ImGuiTableFlags_BordersOuterV) { table->HostClipRect.Min.x = ImMin(table->HostClipRect.Min.x + border_size, table->HostClipRect.Max.x); @@ -527,8 +527,15 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect; table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width table->InnerClipRect.ClipWithFull(table->HostClipRect); - table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : table->HostClipRect.Max.y; - + if (flags & ImGuiTableFlags_NoHostExtendY) + { + if (flags & ImGuiTableFlags_BordersOuterH) + table->InnerClipRect.Max.y = ImClamp(table->OuterRect.Max.y - border_size, table->InnerClipRect.Min.y, table->InnerClipRect.Max.y); + } + else + { + table->InnerClipRect.Max.y = table->HostClipRect.Max.y; + } table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow() table->RowCellPaddingY = 0.0f; @@ -2734,6 +2741,8 @@ void ImGui::TableSetupDrawChannels(ImGuiTable* table) table->Bg0ClipRectForDrawCmd = table->OuterWindow->ClipRect; table->Bg2ClipRectForDrawCmd = table->HostClipRect; IM_ASSERT(table->BgClipRect.Min.y <= table->BgClipRect.Max.y); + if (table->Flags & ImGuiTableFlags_NoHostExtendY) + table->Bg2ClipRectForDrawCmd.Max.y = ImMin(table->Bg2ClipRectForDrawCmd.Max.y, table->BgClipRect.Max.y); // Don't apply to Bg0: shapes in Bg0 are already CPU clipped and it makes merging fails. } // This function reorder draw channels based on matching clip rectangle, to facilitate merging them. Called by EndTable(). From c39a91bfbecc319847e9d4a9b96f320031fd957b Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Oct 2026 18:40:27 +0100 Subject: [PATCH 41/72] Tables: latch border size once, and pull all use from same place. (#9415) --- imgui_internal.h | 1 + imgui_tables.cpp | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/imgui_internal.h b/imgui_internal.h index 16743905c..da6d68730 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -3156,6 +3156,7 @@ struct IMGUI_API ImGuiTable ImU32 BorderColorLight; float BorderX1; float BorderX2; + float BorderSize; float HostIndentX; float MinColumnWidth; float OuterPaddingX; diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 0c0796384..4d0ae97d8 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -478,11 +478,14 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG temp_data->HostBackupItemWidthStackSize = outer_window->DC.ItemWidthStack.Size; inner_window->DC.PrevLineSize = inner_window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); + // Border size + // FIXME-WIP: Changing this is not currently simple due to ClipRect requirements. Easier to manage with new 1.93 primitives though. + const float border_size = table->BorderSize = TABLE_BORDER_SIZE; + // Make borders not overlap our contents by offsetting HostClipRect (#6765, #7428, #3752) // (we normally shouldn't alter HostClipRect as we rely on TableMergeDrawChannels() expanding non-clipped column toward the // limits of that rectangle, in order for ImDrawListSplitter::Merge() to merge the draw commands. However since the overlap // problem only affect scrolling tables in this case we can get away with doing it without extra cost). - const float border_size = TABLE_BORDER_SIZE; if (inner_window != outer_window) { // FIXME: Because inner_window's Scrollbar doesn't know about border size, since it's not encoded in window->WindowBorderSize, @@ -509,14 +512,14 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG // - PadOuter+PadInner | Pad ..Content.. Pad | Pad ..Content.. Pad | const bool pad_outer_x = (flags & ImGuiTableFlags_NoPadOuterX) ? false : (flags & ImGuiTableFlags_PadOuterX) ? true : (flags & ImGuiTableFlags_BordersOuterV) != 0; const bool pad_inner_x = (flags & ImGuiTableFlags_NoPadInnerX) ? false : true; - const float inner_spacing_for_border = (flags & ImGuiTableFlags_BordersInnerV) ? TABLE_BORDER_SIZE : 0.0f; + const float inner_spacing_for_border = (flags & ImGuiTableFlags_BordersInnerV) ? border_size : 0.0f; const float inner_spacing_explicit = (pad_inner_x && (flags & ImGuiTableFlags_BordersInnerV) == 0) ? g.Style.CellPadding.x : 0.0f; const float inner_padding_explicit = (pad_inner_x && (flags & ImGuiTableFlags_BordersInnerV) != 0) ? g.Style.CellPadding.x : 0.0f; table->CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border; table->CellSpacingX2 = inner_spacing_explicit; table->CellPaddingX = inner_padding_explicit; - const float outer_padding_for_border = (flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f; + const float outer_padding_for_border = (flags & ImGuiTableFlags_BordersOuterV) ? border_size : 0.0f; const float outer_padding_explicit = pad_outer_x ? g.Style.CellPadding.x : 0.0f; table->OuterPaddingX = (outer_padding_for_border + outer_padding_explicit) - table->CellPaddingX; @@ -1284,7 +1287,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) } if (order_n < table->FreezeColumnsCount) - host_clip_rect.Min.x = ImClamp(column->MaxX + TABLE_BORDER_SIZE, host_clip_rect.Min.x, host_clip_rect.Max.x); + host_clip_rect.Min.x = ImClamp(column->MaxX + table->BorderSize, host_clip_rect.Min.x, host_clip_rect.Max.x); offset_x += column->WidthGiven + table->CellSpacingX1 + table->CellSpacingX2 + table->CellPaddingX * 2.0f; } @@ -1510,7 +1513,7 @@ void ImGui::EndTable() // but since the later is likely to be impossible to do we'd rather update both axes together. if (table->Flags & ImGuiTableFlags_ScrollX) { - const float outer_padding_for_border = (table->Flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f; + const float outer_padding_for_border = (table->Flags & ImGuiTableFlags_BordersOuterV) ? table->BorderSize : 0.0f; float max_pos_x = inner_window->DC.CursorMaxPos.x; if (table->RightMostEnabledColumn != -1) max_pos_x = ImMax(max_pos_x, table->Columns[table->RightMostEnabledColumn].WorkMaxX + table->CellPaddingX + table->OuterPaddingX - outer_padding_for_border); @@ -2175,7 +2178,6 @@ void ImGui::TableEndRow(ImGuiTable* table) // Decide of top border color ImU32 top_border_col = 0; - const float border_size = TABLE_BORDER_SIZE; if (table->CurrentRow > 0 && (table->Flags & ImGuiTableFlags_BordersInnerH)) top_border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight; @@ -2222,11 +2224,11 @@ void ImGui::TableEndRow(ImGuiTable* table) // Draw top border if (top_border_col && bg_y1 >= table->BgClipRect.Min.y && bg_y1 < table->BgClipRect.Max.y) - window->DrawList->AddLineH(table->BorderX1, table->BorderX2, bg_y1, top_border_col, border_size); + window->DrawList->AddLineH(table->BorderX1, table->BorderX2, bg_y1, top_border_col, table->BorderSize); // Draw bottom border at the row unfreezing mark (always strong) if (draw_strong_bottom_border && bg_y2 >= table->BgClipRect.Min.y && bg_y2 < table->BgClipRect.Max.y) - window->DrawList->AddLineH(table->BorderX1, table->BorderX2, bg_y2, table->BorderColorStrong, border_size); + window->DrawList->AddLineH(table->BorderX1, table->BorderX2, bg_y2, table->BorderColorStrong, table->BorderSize); } // End frozen rows (when we are past the last frozen row line, teleport cursor and alter clipping rectangle) @@ -2967,9 +2969,8 @@ void ImGui::TableDrawBorders(ImGuiTable* table) table->DrawSplitter->SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0); inner_drawlist->PushClipRect(table->OuterWindow->ClipRect.Min, table->OuterWindow->ClipRect.Max, false); - const float border_size = TABLE_BORDER_SIZE; - // For e.g. non scrolling table we limit vertex coordinates in order to keep ImDrawCmd AABB roughly within visible range. + const float border_size = table->BorderSize; const float draw_y2_limit = table->OuterWindow->ClipRect.Max.y + (2.0f * ImMax(border_size, inner_drawlist->_FringeScale)); // Draw inner border and resizing feedback @@ -3640,8 +3641,9 @@ void ImGui::TableAngledHeadersRowEx(ImGuiID row_id, float angle, float max_label if (pass == 1) { // Draw border - const float border_size = TABLE_BORDER_SIZE; - draw_list->AddLine(bg_shape[0] + ImVec2(border_size * 0.5f, 0.0f), bg_shape[3] + ImVec2(border_size * 0.5f, 0.0f), TableGetColumnBorderCol(table, order_n, column_n), border_size); + draw_list->AddLine( + bg_shape[0] + ImVec2(table->BorderSize * 0.5f, 0.0f), + bg_shape[3] + ImVec2(table->BorderSize * 0.5f, 0.0f), TableGetColumnBorderCol(table, order_n, column_n), table->BorderSize); } } PopClipRect(); From 0d0cd87dd26fd5cda7858f9c02a811c84487a714 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Oct 2026 18:56:20 +0100 Subject: [PATCH 42/72] Tables: fixed vertical inner borders slightly overlapping bottom outer border. (#4678, #9415) --- docs/CHANGELOG.txt | 2 ++ imgui_tables.cpp | 27 ++++++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index fbd0a60f9..d20a74cf0 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -85,6 +85,8 @@ Other Changes: - Fixed selectable highlight straying off the Y2 clipping limit. - Fixed parent window work rectangle affecting the Y2 clipping limit. - Fixed the Y2 clipping limit overlapping bottom outer border. + - Fixed vertical inner borders slightly overlapping bottom outer border + (may be visible with transparent borders). - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 4d0ae97d8..120c29364 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -2970,13 +2970,15 @@ void ImGui::TableDrawBorders(ImGuiTable* table) inner_drawlist->PushClipRect(table->OuterWindow->ClipRect.Min, table->OuterWindow->ClipRect.Max, false); // For e.g. non scrolling table we limit vertex coordinates in order to keep ImDrawCmd AABB roughly within visible range. - const float border_size = table->BorderSize; - const float draw_y2_limit = table->OuterWindow->ClipRect.Max.y + (2.0f * ImMax(border_size, inner_drawlist->_FringeScale)); + const float border_size_outer_w = (table->Flags & ImGuiTableFlags_BordersOuterV) ? table->BorderSize : 0.0f; + const float border_size_outer_h = (table->Flags & ImGuiTableFlags_BordersOuterH) ? table->BorderSize : 0.0f; + const float border_size_inner = table->BorderSize; + const float draw_y2_limit = table->OuterWindow->ClipRect.Max.y + (2.0f * ImMax(border_size_outer_h, inner_drawlist->_FringeScale)); // Draw inner border and resizing feedback ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); - const float draw_y1 = ImMax(table->InnerRect.Min.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->AngledHeadersHeight) + ((table->Flags & ImGuiTableFlags_BordersOuterH) ? border_size : 0.0f); - const float draw_y2_body = ImMin(table->InnerRect.Max.y, draw_y2_limit); + const float draw_y1 = ImMax(table->InnerRect.Min.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->AngledHeadersHeight) + ((table->Flags & ImGuiTableFlags_BordersOuterH) ? border_size_outer_h : 0.0f); + const float draw_y2_body = ImMin(table->InnerRect.Max.y - border_size_outer_h, draw_y2_limit); const float draw_y2_head = table->IsUsingHeaders ? ImMin(draw_y2_body, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table_instance->LastTopHeadersRowHeight) : draw_y1; if (table->Flags & ImGuiTableFlags_BordersInnerV) @@ -3011,7 +3013,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table) else if ((table->Flags & (ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_NoBordersInBody)) == 0) draw_y2 = draw_y2_body; if (draw_y2 > draw_y1) - inner_drawlist->AddLineV(column->MaxX, draw_y1, draw_y2, TableGetColumnBorderCol(table, order_n, column_n), border_size); + inner_drawlist->AddLineV(column->MaxX, draw_y1, draw_y2, TableGetColumnBorderCol(table, order_n, column_n), border_size_inner); } } @@ -3029,26 +3031,25 @@ void ImGui::TableDrawBorders(ImGuiTable* table) const ImU32 outer_col = table->BorderColorStrong; if ((table->Flags & ImGuiTableFlags_BordersOuter) == ImGuiTableFlags_BordersOuter) { - inner_drawlist->AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0f, border_size); + inner_drawlist->AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0f, border_size_outer_w); } else if (table->Flags & ImGuiTableFlags_BordersOuterV) { - inner_drawlist->AddLineV(outer_border.Min.x, outer_border.Min.y, outer_border.Max.y, outer_col, border_size); - inner_drawlist->AddLineV(outer_border.Max.x - border_size, outer_border.Min.y, outer_border.Max.y, outer_col, border_size); + inner_drawlist->AddLineV(outer_border.Min.x, outer_border.Min.y, outer_border.Max.y, outer_col, border_size_outer_w); + inner_drawlist->AddLineV(outer_border.Max.x - border_size_outer_w, outer_border.Min.y, outer_border.Max.y, outer_col, border_size_outer_w); } else if (table->Flags & ImGuiTableFlags_BordersOuterH) { - inner_drawlist->AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Min.y, outer_col, border_size); - inner_drawlist->AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Max.y - border_size, outer_col, border_size); + inner_drawlist->AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Min.y, outer_col, border_size_outer_h); + inner_drawlist->AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Max.y - border_size_outer_h, outer_col, border_size_outer_h); } } if ((table->Flags & ImGuiTableFlags_BordersInnerH) && table->RowPosY2 < table->OuterRect.Max.y) { - // Draw bottom-most row border between it is above outer border. - const float h_inset = (table->Flags & ImGuiTableFlags_BordersOuterV) ? border_size : 0.0f; + // Draw bottom-most row border between it and above outer border. const float border_y = table->RowPosY2; if (border_y >= table->BgClipRect.Min.y && border_y < table->BgClipRect.Max.y) - inner_drawlist->AddLineH(table->BorderX1 + h_inset, table->BorderX2 - h_inset, border_y, table->BorderColorLight, border_size); + inner_drawlist->AddLineH(table->BorderX1 + border_size_outer_w, table->BorderX2 - border_size_outer_w, border_y, table->BorderColorLight, border_size_inner); } inner_drawlist->PopClipRect(); From c1581882a4f2703fa81354fea9173c0f92579873 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Oct 2026 20:14:03 +0100 Subject: [PATCH 43/72] Tables: fixed various border overshooting issues, some mostly visible with transparent borders: (#4678, #9415) As a side effect of cleaning up a few things, altering border size becomes closer to being correct. --- docs/CHANGELOG.txt | 11 ++++++---- imgui_internal.h | 1 + imgui_tables.cpp | 53 +++++++++++++++++++--------------------------- 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index d20a74cf0..96ebe7493 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -79,14 +79,17 @@ Other Changes: - Modals: fixed an assert displaying a modal in an environment where `io.DisplayFramebufferScale` is not an integer (regression in 1.93.0). (#9598) - Tables: - - In non-scrolling tables, clamp lower border coordinates to stay within visible - range (no visible changes, but ImDrawCmd AABB becomes more sensible). + - Fixed various border overshooting issues, some mostly visible with transparent + borders: (#4678) + - On non-scrolling tables, inner horizontal borders slightly overlapped + outer vertical ones with certain settings. + - On non-scrolling tables, clamping lower border coordinates to stay within + visible range (no visible change, but it makes ImDrawCmd AABB more sensible). + - Fixed vertical inner borders slightly overlapping bottom outer border. - Fixed various issues with using `ImGuiTableFlags_NoHostExtendY`: - Fixed selectable highlight straying off the Y2 clipping limit. - Fixed parent window work rectangle affecting the Y2 clipping limit. - Fixed the Y2 clipping limit overlapping bottom outer border. - - Fixed vertical inner borders slightly overlapping bottom outer border - (may be visible with transparent borders). - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui_internal.h b/imgui_internal.h index da6d68730..001bc687c 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -653,6 +653,7 @@ struct IMGUI_API ImRect void TranslateY(float dy) { Min.y += dy; Max.y += dy; } void ClipWith(const ImRect& r) { Min = ImMax(Min, r.Min); Max = ImMin(Max, r.Max); } // Simple version, may lead to an inverted rectangle, which is fine for Contains/Overlaps test but not for display. void ClipWithFull(const ImRect& r) { Min = ImClamp(Min, r.Min, r.Max); Max = ImClamp(Max, r.Min, r.Max); } // Full version, ensure both points are fully clipped. + void ShrinkClamp(const ImVec2& inset_min, const ImVec2& inset_max) { Min.x = ImMin(Min.x + inset_min.x, Max.x); Min.y = ImMin(Min.y + inset_min.y, Max.y); Max.x = ImMax(Max.x - inset_max.x, Min.x); Max.y = ImMax(Max.y - inset_max.y, Min.y); } bool IsInverted() const { return Min.x > Max.x || Min.y > Max.y; } ImVec4 ToVec4() const { return ImVec4(Min.x, Min.y, Max.x, Max.y); } const ImVec4& AsVec4() const { return *(const ImVec4*)&Min.x; } diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 120c29364..f05c29f73 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -483,27 +483,22 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG const float border_size = table->BorderSize = TABLE_BORDER_SIZE; // Make borders not overlap our contents by offsetting HostClipRect (#6765, #7428, #3752) - // (we normally shouldn't alter HostClipRect as we rely on TableMergeDrawChannels() expanding non-clipped column toward the - // limits of that rectangle, in order for ImDrawListSplitter::Merge() to merge the draw commands. However since the overlap - // problem only affect scrolling tables in this case we can get away with doing it without extra cost). - if (inner_window != outer_window) + // - We normally shouldn't alter HostClipRect as we rely on TableMergeDrawChannels() expanding non-clipped column toward the + // limits of that rectangle, in order for ImDrawListSplitter::Merge() to merge the draw commands. However since the overlap + // problem only affect scrolling tables in this case we can get away with doing it without extra cost). + // - (FIXME: Because inner_window's Scrollbar doesn't know about border size, since it's not encoded in window->WindowBorderSize, + // it already overlaps it and doesn't need an extra offset. Ideally we should be able to pass custom border size with + // different x/y values to BeginChild().) + // - For non-scrolling window, this is applied to table->InnerClipRect below. + ImRect border_size_outer = { - // FIXME: Because inner_window's Scrollbar doesn't know about border size, since it's not encoded in window->WindowBorderSize, - // it already overlaps it and doesn't need an extra offset. Ideally we should be able to pass custom border size with - // different x/y values to BeginChild(). - if (flags & ImGuiTableFlags_BordersOuterV) - { - table->HostClipRect.Min.x = ImMin(table->HostClipRect.Min.x + border_size, table->HostClipRect.Max.x); - if (inner_window->DecoOuterSizeX2 == 0.0f) - table->HostClipRect.Max.x = ImMax(table->HostClipRect.Max.x - border_size, table->HostClipRect.Min.x); - } - if (flags & ImGuiTableFlags_BordersOuterH) - { - table->HostClipRect.Min.y = ImMin(table->HostClipRect.Min.y + border_size, table->HostClipRect.Max.y); - if (inner_window->DecoOuterSizeY2 == 0.0f) - table->HostClipRect.Max.y = ImMax(table->HostClipRect.Max.y - border_size, table->HostClipRect.Min.y); - } - } + (flags & ImGuiTableFlags_BordersOuterV) ? border_size : 0.0f, + (flags & ImGuiTableFlags_BordersOuterH) ? border_size : 0.0f, + ((flags & ImGuiTableFlags_BordersOuterV) && ((inner_window == outer_window) || inner_window->DecoOuterSizeX2 == 0.0f)) ? border_size : 0.0f, + ((flags & ImGuiTableFlags_BordersOuterH) && ((inner_window == outer_window) || inner_window->DecoOuterSizeY2 == 0.0f)) ? border_size : 0.0f, + }; + if (inner_window != outer_window) + table->HostClipRect.ShrinkClamp(border_size_outer.Min, border_size_outer.Max); // Padding and Spacing // - None ........Content..... Pad .....Content........ @@ -528,17 +523,13 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->RowBgColorCounter = 0; table->LastRowFlags = ImGuiTableRowFlags_None; table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect; + if (inner_window == outer_window) + table->InnerClipRect.ShrinkClamp(border_size_outer.Min, border_size_outer.Max); table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width table->InnerClipRect.ClipWithFull(table->HostClipRect); - if (flags & ImGuiTableFlags_NoHostExtendY) - { - if (flags & ImGuiTableFlags_BordersOuterH) - table->InnerClipRect.Max.y = ImClamp(table->OuterRect.Max.y - border_size, table->InnerClipRect.Min.y, table->InnerClipRect.Max.y); - } - else - { + if ((flags & ImGuiTableFlags_NoHostExtendY) == 0) table->InnerClipRect.Max.y = table->HostClipRect.Max.y; - } + table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow() table->RowCellPaddingY = 0.0f; @@ -1513,10 +1504,10 @@ void ImGui::EndTable() // but since the later is likely to be impossible to do we'd rather update both axes together. if (table->Flags & ImGuiTableFlags_ScrollX) { - const float outer_padding_for_border = (table->Flags & ImGuiTableFlags_BordersOuterV) ? table->BorderSize : 0.0f; + const float border_size_outer_w = (table->Flags & ImGuiTableFlags_BordersOuterV) ? table->BorderSize : 0.0f; float max_pos_x = inner_window->DC.CursorMaxPos.x; if (table->RightMostEnabledColumn != -1) - max_pos_x = ImMax(max_pos_x, table->Columns[table->RightMostEnabledColumn].WorkMaxX + table->CellPaddingX + table->OuterPaddingX - outer_padding_for_border); + max_pos_x = ImMax(max_pos_x, table->Columns[table->RightMostEnabledColumn].WorkMaxX + table->CellPaddingX + table->OuterPaddingX - border_size_outer_w); if (table->ResizedColumn != -1) max_pos_x = ImMax(max_pos_x, table->ResizeLockMinContentsX2); inner_window->DC.CursorMaxPos.x = max_pos_x + table->TempData->AngledHeadersExtraWidth; @@ -3049,7 +3040,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table) // Draw bottom-most row border between it and above outer border. const float border_y = table->RowPosY2; if (border_y >= table->BgClipRect.Min.y && border_y < table->BgClipRect.Max.y) - inner_drawlist->AddLineH(table->BorderX1 + border_size_outer_w, table->BorderX2 - border_size_outer_w, border_y, table->BorderColorLight, border_size_inner); + inner_drawlist->AddLineH(table->BorderX1, table->BorderX2, border_y, table->BorderColorLight, border_size_inner); } inner_drawlist->PopClipRect(); From 89845f9db638c998c33d2a6a0d30dd65ff9c9369 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Oct 2026 20:42:01 +0100 Subject: [PATCH 44/72] Tables: fixed various issues with using ImGuiTableFlags_NoHostExtendX. --- docs/CHANGELOG.txt | 6 +++--- imgui_tables.cpp | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 96ebe7493..dddcff7a2 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -80,14 +80,14 @@ Other Changes: `io.DisplayFramebufferScale` is not an integer (regression in 1.93.0). (#9598) - Tables: - Fixed various border overshooting issues, some mostly visible with transparent - borders: (#4678) + borders and under specific conditions: (#4678) - On non-scrolling tables, inner horizontal borders slightly overlapped outer vertical ones with certain settings. - On non-scrolling tables, clamping lower border coordinates to stay within visible range (no visible change, but it makes ImDrawCmd AABB more sensible). - Fixed vertical inner borders slightly overlapping bottom outer border. - - Fixed various issues with using `ImGuiTableFlags_NoHostExtendY`: - - Fixed selectable highlight straying off the Y2 clipping limit. + - Fixed various issues using `ImGuiTableFlags_NoHostExtendX`/`_NoHostExtendY`: + - Fixed selectable highlight straying off the X2/Y2 clipping limit. - Fixed parent window work rectangle affecting the Y2 clipping limit. - Fixed the Y2 clipping limit overlapping bottom outer border. - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro diff --git a/imgui_tables.cpp b/imgui_tables.cpp index f05c29f73..b46f23b04 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -1310,8 +1310,9 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) table->Flags &= ~ImGuiTableFlags_NoHostExtendX; if (table->Flags & ImGuiTableFlags_NoHostExtendX) { - table->OuterRect.Max.x = table->WorkRect.Max.x = unused_x1; - table->InnerClipRect.Max.x = ImMin(table->InnerClipRect.Max.x, unused_x1); + const float border_size_outer_w = (table->Flags & ImGuiTableFlags_BordersOuterV) ? table->BorderSize : 0.0f; + table->OuterRect.Max.x = table->WorkRect.Max.x = ImMin(table->OuterRect.Max.x, unused_x1 + border_size_outer_w); + table->InnerClipRect.Max.x = ImClamp(table->OuterRect.Max.x - border_size_outer_w, table->InnerClipRect.Min.x, table->InnerClipRect.Max.x); } table->InnerWindow->ParentWorkRect = table->WorkRect; table->BorderX1 = table->InnerClipRect.Min.x; @@ -2734,8 +2735,10 @@ void ImGui::TableSetupDrawChannels(ImGuiTable* table) table->Bg0ClipRectForDrawCmd = table->OuterWindow->ClipRect; table->Bg2ClipRectForDrawCmd = table->HostClipRect; IM_ASSERT(table->BgClipRect.Min.y <= table->BgClipRect.Max.y); + if (table->Flags & ImGuiTableFlags_NoHostExtendX) + table->Bg2ClipRectForDrawCmd.Max.x = ImMin(table->Bg2ClipRectForDrawCmd.Max.x, table->BgClipRect.Max.x); // Don't apply to Bg0: shapes in Bg0 are already CPU clipped and it makes merging fails. if (table->Flags & ImGuiTableFlags_NoHostExtendY) - table->Bg2ClipRectForDrawCmd.Max.y = ImMin(table->Bg2ClipRectForDrawCmd.Max.y, table->BgClipRect.Max.y); // Don't apply to Bg0: shapes in Bg0 are already CPU clipped and it makes merging fails. + table->Bg2ClipRectForDrawCmd.Max.y = ImMin(table->Bg2ClipRectForDrawCmd.Max.y, table->BgClipRect.Max.y); // " } // This function reorder draw channels based on matching clip rectangle, to facilitate merging them. Called by EndTable(). @@ -2893,7 +2896,7 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) merge_clip_rect.Min.x = ImMin(merge_clip_rect.Min.x, host_rect.Min.x); if ((merge_group_n & 2) == 0 || !has_freeze_v) merge_clip_rect.Min.y = ImMin(merge_clip_rect.Min.y, host_rect.Min.y); - if ((merge_group_n & 1) != 0) + if ((merge_group_n & 1) != 0 && (table->Flags & ImGuiTableFlags_NoHostExtendX) == 0) merge_clip_rect.Max.x = ImMax(merge_clip_rect.Max.x, host_rect.Max.x); if ((merge_group_n & 2) != 0 && (table->Flags & ImGuiTableFlags_NoHostExtendY) == 0) merge_clip_rect.Max.y = ImMax(merge_clip_rect.Max.y, host_rect.Max.y); From f88ec043afbb800c99d05ad74e348bd70e10da9d Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 29 Oct 2026 20:56:04 +0100 Subject: [PATCH 45/72] Tables: use center-bias for horizontal borders to better support thick borders. (#9415) + Demo: adjust colors in 'Background Color' section to better showcase the blending difference between Bg0 and Bg1. --- imgui_demo.cpp | 10 +++++++--- imgui_tables.cpp | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 547661f7d..a2afd55ad 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -6428,7 +6428,9 @@ static void DemoWindowTables() { static char text_bufs[3 * 5][16]; // Mini text storage for 3x5 cells static bool init = true; - if (!show_widget_frame_bg) + if (show_widget_frame_bg) + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); + else ImGui::PushStyleColor(ImGuiCol_FrameBg, 0); for (int cell = 0; cell < 3 * 5; cell++) { @@ -6440,7 +6442,9 @@ static void DemoWindowTables() ImGui::InputText("##cell", text_bufs[cell], IM_COUNTOF(text_bufs[cell])); ImGui::PopID(); } - if (!show_widget_frame_bg) + if (show_widget_frame_bg) + ImGui::PopStyleVar(); + else ImGui::PopStyleColor(); init = false; ImGui::EndTable(); @@ -7050,7 +7054,7 @@ static void DemoWindowTables() // We use a transparent color so we can see the one behind in case our target is RowBg1 and RowBg0 was already targeted by the ImGuiTableFlags_RowBg flag. if (row_bg_type != 0) { - ImU32 row_bg_color = ImGui::GetColorU32(row_bg_type == 1 ? ImVec4(0.7f, 0.3f, 0.3f, 0.65f) : ImVec4(0.2f + row * 0.1f, 0.2f, 0.2f, 0.65f)); // Flat or Gradient? + ImU32 row_bg_color = ImGui::GetColorU32(row_bg_type == 1 ? ImVec4(0.7f, 0.3f, 0.3f, 0.40f) : ImVec4(0.2f + row * 0.1f, 0.2f, 0.2f, 0.40f)); // Flat or Gradient? ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0 + row_bg_target, row_bg_color); } diff --git a/imgui_tables.cpp b/imgui_tables.cpp index b46f23b04..483cf3004 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -2216,11 +2216,11 @@ void ImGui::TableEndRow(ImGuiTable* table) // Draw top border if (top_border_col && bg_y1 >= table->BgClipRect.Min.y && bg_y1 < table->BgClipRect.Max.y) - window->DrawList->AddLineH(table->BorderX1, table->BorderX2, bg_y1, top_border_col, table->BorderSize); + window->DrawList->AddLineH(table->BorderX1, table->BorderX2, bg_y1, top_border_col, table->BorderSize, ImDrawFlags_StrokeCenterBiased); // Draw bottom border at the row unfreezing mark (always strong) if (draw_strong_bottom_border && bg_y2 >= table->BgClipRect.Min.y && bg_y2 < table->BgClipRect.Max.y) - window->DrawList->AddLineH(table->BorderX1, table->BorderX2, bg_y2, table->BorderColorStrong, table->BorderSize); + window->DrawList->AddLineH(table->BorderX1, table->BorderX2, bg_y2, table->BorderColorStrong, table->BorderSize, ImDrawFlags_StrokeCenterBiased); } // End frozen rows (when we are past the last frozen row line, teleport cursor and alter clipping rectangle) From a13badd73e3780690208fde799edb1e73c2f8377 Mon Sep 17 00:00:00 2001 From: MilosLord Date: Fri, 30 Oct 2026 11:56:02 +0100 Subject: [PATCH 46/72] MultiSelect: fixed ImGuiSelectionBasicStorage::GetNextSelectedItem() reading past the end of storage when trailing items are unselected (#9604) --- docs/CHANGELOG.txt | 3 +++ imgui_widgets.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index dddcff7a2..4ba908f4f 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -90,6 +90,9 @@ Other Changes: - Fixed selectable highlight straying off the X2/Y2 clipping limit. - Fixed parent window work rectangle affecting the Y2 clipping limit. - Fixed the Y2 clipping limit overlapping bottom outer border. +- Multi-Select: + - Fixed `ImGuiSelectionBasicStorage::GetNextSelectedItem()` reading one past the + end of storage when trailing items are unselected (#9604) [@MilosLord] - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index e1a884429..0b862b437 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -8803,7 +8803,7 @@ bool ImGuiSelectionBasicStorage::GetNextSelectedItem(void** opaque_it, ImGuiID* it = _Storage.Data.Data; IM_ASSERT(it >= _Storage.Data.Data && it <= it_end); if (it != it_end) - while (it->val_i == 0 && it < it_end) + while (it < it_end && it->val_i == 0) it++; const bool has_more = (it != it_end); *opaque_it = has_more ? (void**)(it + 1) : (void**)(it); From 1023d3ddaa75072806f6d11c7b434ed031ea14c1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 30 Oct 2026 17:32:06 +0100 Subject: [PATCH 47/72] InputText: fixed ImGuiInputTextCallbackData::InsertChars() mistakenly over growing internal buffer. (#9603, #7925) Note that the 32-256 ranges may seem misleading because ImVector<> handle its growth policy but it is also the size we request to underlying user impl hence the clamps. --- imgui_widgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 0b862b437..f36a888c2 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4471,7 +4471,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons if (new_text_len + BufTextLen + 1 > obj->TextA.Size && is_resizable && !is_readonly) { IM_ASSERT(Buf == obj->TextA.Data); - int new_buf_size = BufTextLen + ImClamp(new_text_len * 4, 32, ImMax(256, new_text_len)) + 1; + int new_buf_size = BufTextLen + ImClamp(new_text_len, 32, ImMax(256, new_text_len)) + 1; obj->TextA.resize(new_buf_size + 1); obj->TextSrc = obj->TextA.Data; Buf = obj->TextA.Data; From 391f714c3736206b896b63d6d5dfbc6a5e7ed4aa Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 30 Oct 2026 19:54:08 +0100 Subject: [PATCH 48/72] RenderArrow doesn't need 64-bits rounding. Added ImRoundPositive() for consistency. --- imgui_draw.cpp | 6 +++--- imgui_internal.h | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 6ab6c6c45..6d8e3f224 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -7582,9 +7582,9 @@ void ImGui::RenderArrowEx(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float co // Pixel align when at a right angle if (is_fill && (cos_a * sin_a >= -FLT_EPSILON) && (cos_a * sin_a <= FLT_EPSILON)) { - p[0] = ImRoundSigned64(p[0]); - p[1] = ImRoundSigned64(p[1]); - p[2] = ImRoundSigned64(p[2]); + p[0] = ImRoundSigned(p[0]); + p[1] = ImRoundSigned(p[1]); + p[2] = ImRoundSigned(p[2]); } if (is_fill) diff --git a/imgui_internal.h b/imgui_internal.h index 001bc687c..145f3f137 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -284,8 +284,8 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer #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_TRUNC(_VAL) ((float)(int)(_VAL)) // Positive values only! ImTrunc() is not inlined in MSVC debug builds -#define IM_ROUND(_VAL) ((float)(int)((_VAL) + 0.5f)) // Positive values only! +#define IM_TRUNC(_VAL) ((float)(int)(_VAL)) // Positive values only! == ImTrunc() which is not inlined in MSVC debug builds +#define IM_ROUND(_VAL) ((float)(int)((_VAL) + 0.5f)) // Positive values only! == ImRoundPositive() which is not inlined in MSVC debug builds. //#define IM_FLOOR IM_TRUNC // [OBSOLETE] Renamed in 1.90.0 (Sept 2023) // Hint for branch prediction @@ -542,14 +542,16 @@ inline float ImSaturate(float f) { return inline float ImLengthSqr(const ImVec2& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y); } inline float ImLengthSqr(const ImVec4& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y) + (lhs.z * lhs.z) + (lhs.w * lhs.w); } inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = (lhs.x * lhs.x) + (lhs.y * lhs.y); if (d > 0.0f) return ImRsqrt(d); return fail_value; } -inline float ImTrunc(float f) { return (float)(int)(f); } +inline float ImTrunc(float f) { return (float)(int)(f); } // == IM_TRUNC() inline ImVec2 ImTrunc(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); } +inline float ImTrunc64(float f) { return (float)(ImS64)(f); } inline float ImFloor(float f) { return (float)((f >= 0 || (float)(int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf() inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2(ImFloor(v.x), ImFloor(v.y)); } -inline float ImTrunc64(float f) { return (float)(ImS64)(f); } +inline float ImRoundPositive(float f) { return (float)(int)(f + 0.5f); } // == IM_ROUND(). Positive values only. inline float ImRoundPositive64(float f) { return (float)(ImS64)(f + 0.5f); } // Positive values only. +inline float ImRoundSigned(float f) { return (float)(int)(f >= 0.0f ? f + 0.5f : f - 0.5f); } +inline ImVec2 ImRoundSigned(const ImVec2& v) { return ImVec2((float)(int)(v.x >= 0.0f ? v.x + 0.5f : v.x - 0.5f), (float)(int)(v.y >= 0.0f ? v.y + 0.5f : v.y - 0.5f)); } inline float ImRoundSigned64(float f) { return (float)(ImS64)(f >= 0.0f ? f + 0.5f : f - 0.5f); } -inline ImVec2 ImRoundSigned64(const ImVec2& v) { return ImVec2((float)(ImS64)(v.x >= 0.0f ? v.x + 0.5f : v.x - 0.5f), (float)(ImS64)(v.y >= 0.0f ? v.y + 0.5f : v.y - 0.5f)); } inline float ImCeilFast(float f) { int i = (int)f; return (float)(i + (f > (float)i)); } // Consider using the bit-hack version (search for "0x1p120f"). inline int ImModPositive(int a, int b) { return (a + b) % b; } inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; } From 7ee4dbac898be10398e22e5915eb12af9d7acc19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20=C4=90or=C4=91evi=C4=87?= <118117650+MilosLord@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:27:23 +0100 Subject: [PATCH 49/72] imgui_freetype: fixed undefined float to integer conversion when de-multiplying a color glyph with a color above its alpha. (#9599) --- misc/freetype/imgui_freetype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index 975374554..d0d6b8950 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -295,7 +295,7 @@ static void ImGui_ImplFreeType_BlitGlyph(const FT_Bitmap* ft_bitmap, uint32_t* d case FT_PIXEL_MODE_BGRA: { // FIXME: Converting pre-multiplied alpha to straight. Doesn't smell good. - #define DE_MULTIPLY(color, alpha) ImMin((ImU32)(255.0f * (float)color / (float)(alpha + FLT_MIN) + 0.5f), 255u) + #define DE_MULTIPLY(color, alpha) (ImU32)ImMin(255.0f * (float)color / (float)(alpha + FLT_MIN) + 0.5f, 255.0f) for (uint32_t y = 0; y < h; y++, src += src_pitch, dst += dst_pitch) for (uint32_t x = 0; x < w; x++) { From c6affd114531786ed6615c6ef4036cbbed39808e Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 2 Nov 2026 16:13:30 +0100 Subject: [PATCH 50/72] Tables: move code in BeginTableEx() so that RowPosY1 may be assigned before altering WorkRect with padding (subsequent commit). --- imgui_tables.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 483cf3004..f9fe1e487 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -518,21 +518,11 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG const float outer_padding_explicit = pad_outer_x ? g.Style.CellPadding.x : 0.0f; table->OuterPaddingX = (outer_padding_for_border + outer_padding_explicit) - table->CellPaddingX; - table->CurrentColumn = -1; - table->CurrentRow = -1; - table->RowBgColorCounter = 0; - table->LastRowFlags = ImGuiTableRowFlags_None; - table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect; - if (inner_window == outer_window) - table->InnerClipRect.ShrinkClamp(border_size_outer.Min, border_size_outer.Max); - table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width - table->InnerClipRect.ClipWithFull(table->HostClipRect); - if ((flags & ImGuiTableFlags_NoHostExtendY) == 0) - table->InnerClipRect.Max.y = table->HostClipRect.Max.y; - table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow() table->RowCellPaddingY = 0.0f; + table->RowBgColorCounter = 0; + table->LastRowFlags = ImGuiTableRowFlags_None; table->FreezeRowsRequest = table->FreezeRowsCount = 0; // This will be setup by TableSetupScrollFreeze(), if any table->FreezeColumnsRequest = table->FreezeColumnsCount = 0; table->IsUnfrozenRows = true; @@ -542,6 +532,15 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->AngledHeadersHeight = 0.0f; temp_data->AngledHeadersExtraWidth = 0.0f; + table->CurrentColumn = -1; + table->CurrentRow = -1; + table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect; + if (inner_window == outer_window) + table->InnerClipRect.ShrinkClamp(border_size_outer.Min, border_size_outer.Max); + table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width + table->InnerClipRect.ClipWithFull(table->HostClipRect); + if ((flags & ImGuiTableFlags_NoHostExtendY) == 0) + table->InnerClipRect.Max.y = table->HostClipRect.Max.y; // Using opaque colors facilitate overlapping lines of the grid, otherwise we'd need to improve TableDrawBorders() table->BorderColorStrong = GetColorU32(ImGuiCol_TableBorderStrong); table->BorderColorLight = GetColorU32(ImGuiCol_TableBorderLight); From 852269e25f2e7b54469f74853405a8d438e14fa8 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 2 Nov 2026 16:22:54 +0100 Subject: [PATCH 51/72] Tables: fixed Selectable/TreeNode highlight overlapping left/right-most edges when using a border + no scrolling. (#4678) --- imgui_internal.h | 1 + imgui_tables.cpp | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/imgui_internal.h b/imgui_internal.h index 145f3f137..57851e7ee 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -3262,6 +3262,7 @@ struct IMGUI_API ImGuiTableTempData int TableIndex; // Index in g.Tables.Buf[] pool float LastTimeActive; // Last timestamp this structure was used float AngledHeadersExtraWidth; // Used in EndTable() + ImRect BorderOuterSizes; ImVector AngledHeadersRequests; // Used in TableAngledHeadersRow() // FIXME: Single instance is enough? // Topology change diff --git a/imgui_tables.cpp b/imgui_tables.cpp index f9fe1e487..72202580e 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -490,15 +490,12 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG // it already overlaps it and doesn't need an extra offset. Ideally we should be able to pass custom border size with // different x/y values to BeginChild().) // - For non-scrolling window, this is applied to table->InnerClipRect below. - ImRect border_size_outer = - { - (flags & ImGuiTableFlags_BordersOuterV) ? border_size : 0.0f, - (flags & ImGuiTableFlags_BordersOuterH) ? border_size : 0.0f, - ((flags & ImGuiTableFlags_BordersOuterV) && ((inner_window == outer_window) || inner_window->DecoOuterSizeX2 == 0.0f)) ? border_size : 0.0f, - ((flags & ImGuiTableFlags_BordersOuterH) && ((inner_window == outer_window) || inner_window->DecoOuterSizeY2 == 0.0f)) ? border_size : 0.0f, - }; + temp_data->BorderOuterSizes.Min.x = (flags & ImGuiTableFlags_BordersOuterV) ? border_size : 0.0f; + temp_data->BorderOuterSizes.Min.y = (flags & ImGuiTableFlags_BordersOuterH) ? border_size : 0.0f; + temp_data->BorderOuterSizes.Max.x = ((flags & ImGuiTableFlags_BordersOuterV) && ((inner_window == outer_window) || inner_window->DecoOuterSizeX2 == 0.0f)) ? border_size : 0.0f; + temp_data->BorderOuterSizes.Max.y = ((flags & ImGuiTableFlags_BordersOuterH) && ((inner_window == outer_window) || inner_window->DecoOuterSizeY2 == 0.0f)) ? border_size : 0.0f; if (inner_window != outer_window) - table->HostClipRect.ShrinkClamp(border_size_outer.Min, border_size_outer.Max); + table->HostClipRect.ShrinkClamp(temp_data->BorderOuterSizes.Min, temp_data->BorderOuterSizes.Max); // Padding and Spacing // - None ........Content..... Pad .....Content........ @@ -536,7 +533,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->CurrentRow = -1; table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect; if (inner_window == outer_window) - table->InnerClipRect.ShrinkClamp(border_size_outer.Min, border_size_outer.Max); + table->InnerClipRect.ShrinkClamp(temp_data->BorderOuterSizes.Min, temp_data->BorderOuterSizes.Max); table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width table->InnerClipRect.ClipWithFull(table->HostClipRect); if ((flags & ImGuiTableFlags_NoHostExtendY) == 0) @@ -1313,7 +1310,8 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) table->OuterRect.Max.x = table->WorkRect.Max.x = ImMin(table->OuterRect.Max.x, unused_x1 + border_size_outer_w); table->InnerClipRect.Max.x = ImClamp(table->OuterRect.Max.x - border_size_outer_w, table->InnerClipRect.Min.x, table->InnerClipRect.Max.x); } - table->InnerWindow->ParentWorkRect = table->WorkRect; + table->InnerWindow->ParentWorkRect = table->WorkRect; // Used by Selectable/TreeNode highlight + table->InnerWindow->ParentWorkRect.ShrinkClamp(temp_data->BorderOuterSizes.Min, temp_data->BorderOuterSizes.Max); table->BorderX1 = table->InnerClipRect.Min.x; table->BorderX2 = table->InnerClipRect.Max.x; From c5131aff7ea0ee4b932df5a2f08b5237b960a4c3 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 2 Nov 2026 16:31:32 +0100 Subject: [PATCH 52/72] Tables: draw outer border before inner borders. --- imgui_tables.cpp | 54 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 72202580e..d56297a56 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -2966,6 +2966,33 @@ void ImGui::TableDrawBorders(ImGuiTable* table) const float border_size_inner = table->BorderSize; const float draw_y2_limit = table->OuterWindow->ClipRect.Max.y + (2.0f * ImMax(border_size_outer_h, inner_drawlist->_FringeScale)); + // Draw outer border + if (table->Flags & ImGuiTableFlags_BordersOuter) + { + // Display outer border offset by 1 which is a simple way to display it without adding an extra draw call + // (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their + // parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part + // of it in inner window, and the part that's over scrollbars in the outer window..) + // Either solution currently won't allow us to use a larger border size: the border would clipped. + ImRect outer_border = table->OuterRect; + outer_border.Max.y = ImMin(outer_border.Max.y, draw_y2_limit); // Clamp but keep bottom border non-visible. + const ImU32 outer_col = table->BorderColorStrong; + if ((table->Flags & ImGuiTableFlags_BordersOuter) == ImGuiTableFlags_BordersOuter) + { + inner_drawlist->AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0f, border_size_outer_w); + } + else if (table->Flags & ImGuiTableFlags_BordersOuterV) + { + inner_drawlist->AddLineV(outer_border.Min.x, outer_border.Min.y, outer_border.Max.y, outer_col, border_size_outer_w); + inner_drawlist->AddLineV(outer_border.Max.x - border_size_outer_w, outer_border.Min.y, outer_border.Max.y, outer_col, border_size_outer_w); + } + else if (table->Flags & ImGuiTableFlags_BordersOuterH) + { + inner_drawlist->AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Min.y, outer_col, border_size_outer_h); + inner_drawlist->AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Max.y - border_size_outer_h, outer_col, border_size_outer_h); + } + } + // Draw inner border and resizing feedback ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); const float draw_y1 = ImMax(table->InnerRect.Min.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->AngledHeadersHeight) + ((table->Flags & ImGuiTableFlags_BordersOuterH) ? border_size_outer_h : 0.0f); @@ -3008,33 +3035,6 @@ void ImGui::TableDrawBorders(ImGuiTable* table) } } - // Draw outer border - // FIXME: could use AddRect or explicit VLine/HLine helper? - if (table->Flags & ImGuiTableFlags_BordersOuter) - { - // Display outer border offset by 1 which is a simple way to display it without adding an extra draw call - // (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their - // parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part - // of it in inner window, and the part that's over scrollbars in the outer window..) - // Either solution currently won't allow us to use a larger border size: the border would clipped. - ImRect outer_border = table->OuterRect; - outer_border.Max.y = ImMin(outer_border.Max.y, draw_y2_limit); // Clamp but keep bottom border non-visible. - const ImU32 outer_col = table->BorderColorStrong; - if ((table->Flags & ImGuiTableFlags_BordersOuter) == ImGuiTableFlags_BordersOuter) - { - inner_drawlist->AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0f, border_size_outer_w); - } - else if (table->Flags & ImGuiTableFlags_BordersOuterV) - { - inner_drawlist->AddLineV(outer_border.Min.x, outer_border.Min.y, outer_border.Max.y, outer_col, border_size_outer_w); - inner_drawlist->AddLineV(outer_border.Max.x - border_size_outer_w, outer_border.Min.y, outer_border.Max.y, outer_col, border_size_outer_w); - } - else if (table->Flags & ImGuiTableFlags_BordersOuterH) - { - inner_drawlist->AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Min.y, outer_col, border_size_outer_h); - inner_drawlist->AddLineH(outer_border.Min.x, outer_border.Max.x, outer_border.Max.y - border_size_outer_h, outer_col, border_size_outer_h); - } - } if ((table->Flags & ImGuiTableFlags_BordersInnerH) && table->RowPosY2 < table->OuterRect.Max.y) { // Draw bottom-most row border between it and above outer border. From 67f442d5de5ace0e8531442e0cb5446137f01147 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 2 Nov 2026 17:41:04 +0100 Subject: [PATCH 53/72] Tables: workaround/hack for max width 1-off issue when right-most column is resizable. (#4678) Requires !Scroll && Resizable && (NoHostExtendX || RightMostColumnnIsFixed) to see a difference. --- imgui_tables.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index d56297a56..f7a39f689 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -2415,7 +2415,7 @@ void ImGui::TableEndCell(ImGuiTable* table) //------------------------------------------------------------------------- // [SECTION] Tables: Columns width management //------------------------------------------------------------------------- -// - TableGetMaxColumnWidth() [Internal] +// - TableCalcMaxColumnWidth() [Internal] // - TableGetColumnWidthAuto() [Internal] // - TableSetColumnWidth() // - TableSetColumnWidthAutoSingle() [Internal] @@ -3012,14 +3012,21 @@ void ImGui::TableDrawBorders(ImGuiTable* table) const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceCurrent); const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0; const bool is_frozen_separator = (table->FreezeColumnsCount == order_n + 1); - if (column->MaxX > table->InnerClipRect.Max.x && !is_resized) + + // FIXME-TABLE: 1-off display hack for right-most column when resizable (!Scroll && Resizable && (NoHostExtendX || RightMostIsFixed)). + // Fixing actual width would involve altering width_avail in layout and TableCalcMaxColumnWidth(), which would drop the property + // ColumnsGivenWidth == Outer Allocated Width. Worth reworking, but would only make sense if we accept that BorderSize affects layout. + float draw_x2 = column->MaxX; + if (draw_x2 >= table->InnerClipRect.Max.x && draw_x2 - 1.0f <= table->InnerClipRect.Max.x) + draw_x2 = table->InnerClipRect.Max.x; + if (draw_x2 >= table->InnerClipRect.Max.x && !is_resized && !is_hovered) continue; // Decide whether right-most column is visible if (column->NextEnabledColumn == -1 && !is_resizable) if ((table->Flags & ImGuiTableFlags_SizingMask_) != ImGuiTableFlags_SizingFixedSame || (table->Flags & ImGuiTableFlags_NoHostExtendX)) continue; - if (column->MaxX <= column->ClipRect.Min.x) // FIXME-TABLE FIXME-STYLE: Assume BorderSize==1, this is problematic if we want to increase the border size.. + if (draw_x2 <= column->ClipRect.Min.x) // FIXME-TABLE FIXME-STYLE: Assume BorderSize==1, this is problematic if we want to increase the border size.. continue; // Draw in outer window so right-most column won't be clipped @@ -3031,7 +3038,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table) else if ((table->Flags & (ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_NoBordersInBody)) == 0) draw_y2 = draw_y2_body; if (draw_y2 > draw_y1) - inner_drawlist->AddLineV(column->MaxX, draw_y1, draw_y2, TableGetColumnBorderCol(table, order_n, column_n), border_size_inner); + inner_drawlist->AddLineV(draw_x2, draw_y1, draw_y2, TableGetColumnBorderCol(table, order_n, column_n), border_size_inner); } } From 9d0b72573a27d860280811d58ef9ed62f4d46c05 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 3 Nov 2026 20:03:57 +0100 Subject: [PATCH 54/72] Windows: using SetNextWindowPos() with a pivot while a window is hidden and measuring size will still apply temporary position until size is figured out. (#9568) --- docs/CHANGELOG.txt | 3 +++ imgui.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 4ba908f4f..bbd5e0ba4 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -72,6 +72,9 @@ Other Changes: shape and look of arrows. Made default arrow stroked. (#5233, #2431, #2235, #6730, #8243) Legacy arrow: size: (0.60f,0.70f), thickness: 0.0f New arrow: size: (0.72f,0.40f), thickness: 0.30f +- Windows: + - Using `SetNextWindowPos()` with a pivot while a window is hidden and measuring + size will still apply temporary position until size is figured out. (#9568) - TreeNode: - TreeNodeGetOpen(): added flags parameter to allow passing `ImGuiTreeNodeFlags_DefaultOpen` or `ImGuiTreeNodeFlags_Leaf`. (#9569, #9592, #3823, #9251) [@adalisk-emikhaylov, @Yaki-Blake] diff --git a/imgui.cpp b/imgui.cpp index 67edfa37b..4519c96fb 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7994,9 +7994,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->Pos = parent_window->DC.CursorPos; } - const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFramesCannotSkipItems == 0); - if (window_pos_with_pivot) + if (window->SetWindowPosVal.x != FLT_MAX) + { + const ImVec2 backup_pos_val = window->SetWindowPosVal; SetWindowPos(window, window->SetWindowPosVal - window->Size * window->SetWindowPosPivot, 0); // Position given a pivot (e.g. for centering) + if (window->HiddenFramesCannotSkipItems != 0) + window->SetWindowPosVal = backup_pos_val; // Restore set request while hidden, so an updated size will be accounted for. (#9568) + } else if ((flags & ImGuiWindowFlags_ChildMenu) != 0) window->Pos = FindBestWindowPosForPopup(window); else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize) From b2298afa71f942b40f8bbeeb83a24a94acbf795d Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 4 Nov 2026 18:14:26 +0100 Subject: [PATCH 55/72] Examples: Apple: add native menu with Quit entry. Add missing title text. Standardize code. --- .gitignore | 1 + examples/example_apple_metal/main.mm | 15 +++++++++++++++ examples/example_apple_metal4/main.mm | 15 +++++++++++++++ examples/example_apple_opengl2/main.mm | 19 +++++++------------ examples/example_apple_opengl3/main.mm | 19 +++++++------------ 5 files changed, 45 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 009e61ede..730857c1b 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ cmake-build-* ## Unix executables from our example Makefiles examples/example_apple_metal/example_apple_metal +examples/example_apple_metal4/example_apple_metal4 examples/example_apple_opengl2/example_apple_opengl2 examples/example_apple_opengl3/example_apple_opengl3 examples/example_glfw_metal/example_glfw_metal diff --git a/examples/example_apple_metal/main.mm b/examples/example_apple_metal/main.mm index cddc1093c..34811ac4f 100644 --- a/examples/example_apple_metal/main.mm +++ b/examples/example_apple_metal/main.mm @@ -273,6 +273,20 @@ @implementation AppDelegate +-(void)applicationDidFinishLaunching:(NSNotification *)notification +{ + NSMenu* mainMenuBar = [[NSMenu alloc] init]; + NSMenu* appMenu = [[NSMenu alloc] initWithTitle:@"Dear ImGui OSX+Metal Example"]; + NSMenuItem* quitMenuItem = [appMenu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"]; + [quitMenuItem setTarget:NSApp]; + [quitMenuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand]; + + NSMenuItem* appMenuItem = [[NSMenuItem alloc] init]; + [appMenuItem setSubmenu:appMenu]; + [mainMenuBar addItem:appMenuItem]; + [NSApp setMainMenu:mainMenuBar]; +} + -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { return YES; @@ -287,6 +301,7 @@ styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable | NSWindowStyleMaskMiniaturizable backing:NSBackingStoreBuffered defer:NO]; + self.window.title = @"Dear ImGui OSX+Metal Example"; self.window.contentViewController = rootViewController; [self.window center]; [self.window makeKeyAndOrderFront:self]; diff --git a/examples/example_apple_metal4/main.mm b/examples/example_apple_metal4/main.mm index 553eeb34c..5e2d4772b 100644 --- a/examples/example_apple_metal4/main.mm +++ b/examples/example_apple_metal4/main.mm @@ -289,6 +289,20 @@ @implementation AppDelegate +-(void)applicationDidFinishLaunching:(NSNotification *)notification +{ + NSMenu* mainMenuBar = [[NSMenu alloc] init]; + NSMenu* appMenu = [[NSMenu alloc] initWithTitle:@"Dear ImGui OSX+Metal4 Example"]; + NSMenuItem* quitMenuItem = [appMenu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"]; + [quitMenuItem setTarget:NSApp]; + [quitMenuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand]; + + NSMenuItem* appMenuItem = [[NSMenuItem alloc] init]; + [appMenuItem setSubmenu:appMenu]; + [mainMenuBar addItem:appMenuItem]; + [NSApp setMainMenu:mainMenuBar]; +} + -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { return YES; @@ -303,6 +317,7 @@ styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable | NSWindowStyleMaskMiniaturizable backing:NSBackingStoreBuffered defer:NO]; + self.window.title = @"Dear ImGui OSX+Metal4 Example"; self.window.contentViewController = rootViewController; [self.window center]; [self.window makeKeyAndOrderFront:self]; diff --git a/examples/example_apple_opengl2/main.mm b/examples/example_apple_opengl2/main.mm index 67b546ead..e0438d9c9 100644 --- a/examples/example_apple_opengl2/main.mm +++ b/examples/example_apple_opengl2/main.mm @@ -191,19 +191,14 @@ -(void)setupMenu { NSMenu* mainMenuBar = [[NSMenu alloc] init]; - NSMenu* appMenu; - NSMenuItem* menuItem; + NSMenu* appMenu = [[NSMenu alloc] initWithTitle:@"Dear ImGui OSX+OpenGL2 Example"]; + NSMenuItem* quitMenuItem = [appMenu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"]; + [quitMenuItem setTarget:NSApp]; + [quitMenuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand]; - appMenu = [[NSMenu alloc] initWithTitle:@"Dear ImGui OSX+OpenGL2 Example"]; - menuItem = [appMenu addItemWithTitle:@"Quit Dear ImGui OSX+OpenGL2 Example" action:@selector(terminate:) keyEquivalent:@"q"]; - [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand]; - - menuItem = [[NSMenuItem alloc] init]; - [menuItem setSubmenu:appMenu]; - - [mainMenuBar addItem:menuItem]; - - appMenu = nil; + NSMenuItem* appMenuItem = [[NSMenuItem alloc] init]; + [appMenuItem setSubmenu:appMenu]; + [mainMenuBar addItem:appMenuItem]; [NSApp setMainMenu:mainMenuBar]; } diff --git a/examples/example_apple_opengl3/main.mm b/examples/example_apple_opengl3/main.mm index 7cb2e2a33..ffb344343 100644 --- a/examples/example_apple_opengl3/main.mm +++ b/examples/example_apple_opengl3/main.mm @@ -191,19 +191,14 @@ -(void)setupMenu { NSMenu* mainMenuBar = [[NSMenu alloc] init]; - NSMenu* appMenu; - NSMenuItem* menuItem; + NSMenu* appMenu = [[NSMenu alloc] initWithTitle:@"Dear ImGui OSX+OpenGL3 Example"]; + NSMenuItem* quitMenuItem = [appMenu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"]; + [quitMenuItem setTarget:NSApp]; + [quitMenuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand]; - appMenu = [[NSMenu alloc] initWithTitle:@"Dear ImGui OSX+OpenGL3 Example"]; - menuItem = [appMenu addItemWithTitle:@"Quit Dear ImGui OSX+OpenGL3 Example" action:@selector(terminate:) keyEquivalent:@"q"]; - [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand]; - - menuItem = [[NSMenuItem alloc] init]; - [menuItem setSubmenu:appMenu]; - - [mainMenuBar addItem:menuItem]; - - appMenu = nil; + NSMenuItem* appMenuItem = [[NSMenuItem alloc] init]; + [appMenuItem setSubmenu:appMenu]; + [mainMenuBar addItem:appMenuItem]; [NSApp setMainMenu:mainMenuBar]; } From 8c8b8fc266e8cd7fac09340c0373abc28732adb0 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 4 Nov 2026 18:20:12 +0100 Subject: [PATCH 56/72] Examples: Apple: standardize activation and bringing to front. + fix warnings. # Conflicts: # backends/imgui_impl_metal4.mm --- backends/imgui_impl_metal4.mm | 4 ++-- examples/example_apple_metal/main.mm | 4 ++-- examples/example_apple_metal4/main.mm | 4 ++-- examples/example_apple_opengl2/main.mm | 19 ++++++++++--------- examples/example_apple_opengl3/main.mm | 19 ++++++++++--------- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/backends/imgui_impl_metal4.mm b/backends/imgui_impl_metal4.mm index 2f9a53bdb..b811e3d19 100644 --- a/backends/imgui_impl_metal4.mm +++ b/backends/imgui_impl_metal4.mm @@ -139,7 +139,7 @@ void ImGui_ImplMetal4_NewFrame(MTL4RenderPassDescriptor* renderPassDescriptor, i { ImGui_ImplMetal4_Data* bd = ImGui_ImplMetal4_GetBackendData(); IM_ASSERT(bd != nil && "Context or backend not initialized! Did you call ImGui_ImplMetal4_Init()?"); - IM_ASSERT(frameInFlightIndex < bd->SharedMetalContext.framesInFlight && "frameInFlightIndex out of range! See framesInFlight passed to ImGui_ImplMetal4_Init()."); + IM_ASSERT(frameInFlightIndex < (int)bd->SharedMetalContext.framesInFlight && "frameInFlightIndex out of range! See framesInFlight passed to ImGui_ImplMetal4_Init()."); #ifdef IMGUI_IMPL_METAL_CPP bd->SharedMetalContext.framebufferDescriptor = [[[FramebufferDescriptor alloc] initWithRenderPassDescriptor:renderPassDescriptor]autorelease]; #else @@ -479,7 +479,7 @@ bool ImGui_ImplMetal4_Init(id device, id commandQue bd->SharedMetalContext.commandQueue = commandQueue; bd->SharedMetalContext.framesInFlight = (NSUInteger)framesInFlight; NSMutableArray*>* bufferCaches = [NSMutableArray array]; - for (NSUInteger i = 0; i < framesInFlight; i++) + for (NSUInteger i = 0; i < (NSUInteger)framesInFlight; i++) [bufferCaches addObject:[NSMutableArray array]]; bd->SharedMetalContext.bufferCaches = bufferCaches; return true; diff --git a/examples/example_apple_metal/main.mm b/examples/example_apple_metal/main.mm index 34811ac4f..cb27f3330 100644 --- a/examples/example_apple_metal/main.mm +++ b/examples/example_apple_metal/main.mm @@ -111,7 +111,6 @@ #if TARGET_OS_OSX ImGui_ImplOSX_Init(self.view); - [NSApp activateIgnoringOtherApps:YES]; #endif } @@ -285,6 +284,8 @@ [appMenuItem setSubmenu:appMenu]; [mainMenuBar addItem:appMenuItem]; [NSApp setMainMenu:mainMenuBar]; + + [NSApp activateIgnoringOtherApps:YES]; } -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender @@ -349,7 +350,6 @@ int main(int, const char**) AppDelegate *appDelegate = [[AppDelegate alloc] init]; // creates window [NSApp setDelegate:appDelegate]; - [NSApp activateIgnoringOtherApps:YES]; [NSApp run]; } return 0; diff --git a/examples/example_apple_metal4/main.mm b/examples/example_apple_metal4/main.mm index 5e2d4772b..40fbbe764 100644 --- a/examples/example_apple_metal4/main.mm +++ b/examples/example_apple_metal4/main.mm @@ -117,7 +117,6 @@ #if TARGET_OS_OSX ImGui_ImplOSX_Init(self.view); - [NSApp activateIgnoringOtherApps:YES]; #endif } @@ -301,6 +300,8 @@ [appMenuItem setSubmenu:appMenu]; [mainMenuBar addItem:appMenuItem]; [NSApp setMainMenu:mainMenuBar]; + + [NSApp activateIgnoringOtherApps:YES]; } -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender @@ -365,7 +366,6 @@ int main(int, const char**) AppDelegate *appDelegate = [[AppDelegate alloc] init]; // creates window [NSApp setDelegate:appDelegate]; - [NSApp activateIgnoringOtherApps:YES]; [NSApp run]; } return 0; diff --git a/examples/example_apple_opengl2/main.mm b/examples/example_apple_opengl2/main.mm index e0438d9c9..94e03c6d4 100644 --- a/examples/example_apple_opengl2/main.mm +++ b/examples/example_apple_opengl2/main.mm @@ -209,10 +209,6 @@ -(void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Make the application a foreground application (else it won't receive keyboard events) - ProcessSerialNumber psn = {0, kCurrentProcess}; - TransformProcessType(&psn, kProcessTransformToForegroundApplication); - // Menu [self setupMenu]; @@ -236,6 +232,8 @@ NSLog(@"No OpenGL Context!"); [view initialize]; + + [NSApp activateIgnoringOtherApps:YES]; } @end @@ -244,14 +242,17 @@ // Application main() function //----------------------------------------------------------------------------------- -int main(int argc, const char* argv[]) +int main(int, const char**) { @autoreleasepool { - NSApp = [NSApplication sharedApplication]; - AppDelegate* delegate = [[AppDelegate alloc] init]; - [[NSApplication sharedApplication] setDelegate:delegate]; + [NSApplication sharedApplication]; + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + + AppDelegate* appDelegate = [[AppDelegate alloc] init]; + [NSApp setDelegate:appDelegate]; + [NSApp run]; } - return NSApplicationMain(argc, argv); + return 0; } diff --git a/examples/example_apple_opengl3/main.mm b/examples/example_apple_opengl3/main.mm index ffb344343..77c95a90e 100644 --- a/examples/example_apple_opengl3/main.mm +++ b/examples/example_apple_opengl3/main.mm @@ -209,10 +209,6 @@ -(void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Make the application a foreground application (else it won't receive keyboard events) - ProcessSerialNumber psn = {0, kCurrentProcess}; - TransformProcessType(&psn, kProcessTransformToForegroundApplication); - // Menu [self setupMenu]; @@ -237,6 +233,8 @@ NSLog(@"No OpenGL Context!"); [view initialize]; + + [NSApp activateIgnoringOtherApps:YES]; } @end @@ -245,14 +243,17 @@ // Application main() function //----------------------------------------------------------------------------------- -int main(int argc, const char* argv[]) +int main(int, const char**) { @autoreleasepool { - NSApp = [NSApplication sharedApplication]; - AppDelegate* delegate = [[AppDelegate alloc] init]; - [[NSApplication sharedApplication] setDelegate:delegate]; + [NSApplication sharedApplication]; + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + + AppDelegate* appDelegate = [[AppDelegate alloc] init]; + [NSApp setDelegate:appDelegate]; + [NSApp run]; } - return NSApplicationMain(argc, argv); + return 0; } From a1af3c1a59fe81f7a1cac10dcead0a383b99f245 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 5 Nov 2026 11:38:44 +0100 Subject: [PATCH 57/72] Demo: fixed enabling _WrapAround in "Drag and Slider Flags" demo. --- imgui_demo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index a2afd55ad..5545ecc41 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1852,7 +1852,7 @@ static void DemoWindowWidgetsDragsAndSliders() ImGui::Text("Underlying float value: %f", slider_f); ImGui::SliderFloat("SliderFloat (0 -> 1)", &slider_f, 0.0f, 1.0f, "%.3f", flags_for_sliders); ImGui::SliderInt("SliderInt (0 -> 100)", &slider_i, 0, 100, "%d", flags_for_sliders); - ImGui::SliderFloat4("SliderFloat4 (0 -> 1)", slider_f4, 0.0f, 1.0f, "%.3f", flags); // Multi-component item, mostly here to document the effect of ImGuiSliderFlags_ColorMarkers. + ImGui::SliderFloat4("SliderFloat4 (0 -> 1)", slider_f4, 0.0f, 1.0f, "%.3f", flags_for_sliders); // Multi-component item, mostly here to document the effect of ImGuiSliderFlags_ColorMarkers. ImGui::TreePop(); } From 253aa51aba7c3c466b042400c4c16bff81560cda Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 5 Nov 2026 12:38:19 +0100 Subject: [PATCH 58/72] Drags: fixed handling of ImGuiSliderFlags_WrapAround when dragging fast. (#9612, #9611, #7749) --- docs/CHANGELOG.txt | 2 ++ imgui_demo.cpp | 1 + imgui_internal.h | 3 +++ imgui_widgets.cpp | 10 ++++++---- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index bbd5e0ba4..23b05b5b8 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -96,6 +96,8 @@ Other Changes: - Multi-Select: - Fixed `ImGuiSelectionBasicStorage::GetNextSelectedItem()` reading one past the end of storage when trailing items are unselected (#9604) [@MilosLord] +- Drags: fixed handling of `ImGuiSliderFlags_WrapAround`: value could temporarily + escape the range when dragging fast. (#9612, #9611, #7749) [@swayie, @ocornut] - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 5545ecc41..bac1791c3 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1842,6 +1842,7 @@ static void DemoWindowWidgetsDragsAndSliders() //ImGui::DragFloat("DragFloat (0 -> 0)", &drag_f, 0.005f, 0.0f, 0.0f, "%.3f", flags); // To test ClampZeroRange //ImGui::DragFloat("DragFloat (100 -> 100)", &drag_f, 0.005f, 100.0f, 100.0f, "%.3f", flags); ImGui::DragInt("DragInt (0 -> 100)", &drag_i, 0.5f, 0, 100, "%d", flags); + ImGui::DragFloat("DragFloat (0 -> 100)", &drag_f, 0.2f, 0, 100, "%.2f", flags); ImGui::DragFloat4("DragFloat4 (0 -> 1)", drag_f4, 0.005f, 0.0f, 1.0f, "%.3f", flags); // Multi-component item, mostly here to document the effect of ImGuiSliderFlags_ColorMarkers. // Sliders diff --git a/imgui_internal.h b/imgui_internal.h index 57851e7ee..add0b8ce1 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -531,6 +531,9 @@ template T ImLerp(T a, T b, float t) { return template void ImSwap(T& a, T& b) { T tmp = a; a = b; b = tmp; } template T ImAddClampOverflow(T a, T b, T mn, T mx) { if (b < 0 && (a < mn - b)) return mn; if (b > 0 && (a > mx - b)) return mx; return a + b; } template T ImSubClampOverflow(T a, T b, T mn, T mx) { if (b > 0 && (a < mn + b)) return mn; if (b < 0 && (a > mx + b)) return mx; return a - b; } +inline float ImMod(float a, float b) { return ImFmod(a, b); } +inline double ImMod(double a, double b) { return (double)ImFmod((float)a, (float)b); } // FIXME +template T ImMod(T a, T b) { return a % b; } // - Misc maths helpers inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); } inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); } diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index f36a888c2..62bff5880 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -2650,10 +2650,12 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const if (is_wrapped) { // Wrap values - if (v_cur < v_min) - v_cur += v_max - v_min + (is_floating_point ? 0 : 1); - if (v_cur > v_max) - v_cur -= v_max - v_min + (is_floating_point ? 0 : 1); + const TYPE range = v_max - v_min + (is_floating_point ? 0 : 1); + TYPE offset = ImMod((TYPE)(v_cur - v_min), range); + if (offset < 0) + offset += range; + v_cur = (TYPE)(v_min + offset); + IM_ASSERT_PARANOID(v_cur >= v_min && v_cur <= v_max); } else { From dbb30112c619990c593ab46f1855ac08d8ff1e52 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 5 Nov 2026 20:27:54 +0100 Subject: [PATCH 59/72] ColorButton, ColorEdit, ColorPicker: fixed an issue rendering colors when inside a BeginDisabled(false) block. (#9511, #9613, #9614) --- docs/CHANGELOG.txt | 4 ++++ imgui_widgets.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 23b05b5b8..a58b03b6b 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -98,6 +98,10 @@ Other Changes: end of storage when trailing items are unselected (#9604) [@MilosLord] - Drags: fixed handling of `ImGuiSliderFlags_WrapAround`: value could temporarily escape the range when dragging fast. (#9612, #9611, #7749) [@swayie, @ocornut] +- ColorEdit: + - ColorButton, ColorEdit, ColorPicker: fixed an issue rendering colors when + inside a `BeginDisabled(false)` block, caused by the alpha cancelling-out + code in 1.93.0. (#9511, #9613, #9614) [@tksuoran] - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 62bff5880..91f0d0f61 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -6217,7 +6217,8 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl g.NextItemData.ClearFlags(); const float backup_alpha = g.Style.Alpha; - if (g.DisabledStackSize > 0) + const bool is_disabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0 && (g.DisabledStackSize > 0); // Intentionally not check ItemFlagsSet + if (is_disabled) g.Style.Alpha = g.DisabledAlphaBackup; // Cancel out effect of BeginDisabled() for color swatches. PushID(label); @@ -6579,7 +6580,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl g.ColorEditCurrentID = 0; PopID(); - if (g.DisabledStackSize > 0) + if (is_disabled) g.Style.Alpha = backup_alpha; return value_changed; @@ -6620,7 +6621,8 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl const bool is_mixed = (g.LastItemData.ItemFlags & ImGuiItemFlags_MixedValue) != 0; const float backup_alpha = g.Style.Alpha; - if (g.DisabledStackSize > 0) + const bool is_disabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0 && (g.DisabledStackSize > 0); // Intentionally not use LastItemData.ItemFlags here. + if (is_disabled) g.Style.Alpha = g.DisabledAlphaBackup; // Cancel out effect of BeginDisabled() for color swatches. if (is_mixed) { @@ -6648,7 +6650,7 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl else window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(col_source), rounding); } - if (g.DisabledStackSize > 0) + if (is_disabled) g.Style.Alpha = backup_alpha; RenderNavCursor(bb, id); if ((flags & ImGuiColorEditFlags_NoBorder) == 0) From 2a98b48358614c4f3b97517a6c108cda78f8b738 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 9 Nov 2026 11:55:53 +0100 Subject: [PATCH 60/72] CI: update runner for iOS build. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5717f5262..5f0acd670 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -639,7 +639,7 @@ jobs: if: github.event_name == 'workflow_run' Build-iOS: - runs-on: macos-14 + runs-on: macos-26 name: Build - iOS steps: From 1b4a7392f742afb30fe2d90924f06f9d8e093e52 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 9 Nov 2026 12:35:54 +0100 Subject: [PATCH 61/72] Demo: tweaks "Tables" demo. --- imgui_demo.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index bac1791c3..d25f6e560 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -6126,11 +6126,12 @@ static void DemoWindowTables() ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuter", &flags, ImGuiTableFlags_BordersOuter); ImGui::CheckboxFlags("ImGuiTableFlags_BordersInner", &flags, ImGuiTableFlags_BordersInner); ImGui::Unindent(); - + ImGui::AlignTextToFramePadding(); ImGui::Text("Cell contents:"); ImGui::SameLine(); ImGui::RadioButton("Text", &contents_type, CT_Text); ImGui::SameLine(); ImGui::RadioButton("FillButton", &contents_type, CT_FillButton); ImGui::Checkbox("Display headers", &display_headers); + ImGui::CheckboxFlags("ImGuiTableFlags_PadOuterX", &flags, ImGuiTableFlags_PadOuterX); ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appear in Headers)"); PopStyleCompact(); @@ -6358,6 +6359,7 @@ static void DemoWindowTables() "Actual padding values are using style.CellPadding.\n\n" "In this demo we don't show horizontal borders to emphasize how they don't affect default horizontal padding."); + ImGui::PushID("flags1"); static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV; PushStyleCompact(); ImGui::CheckboxFlags("ImGuiTableFlags_PadOuterX", &flags1, ImGuiTableFlags_PadOuterX); @@ -6368,9 +6370,11 @@ static void DemoWindowTables() ImGui::SameLine(); HelpMarker("Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off)"); ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterV", &flags1, ImGuiTableFlags_BordersOuterV); ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerV", &flags1, ImGuiTableFlags_BordersInnerV); + ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", &flags1, ImGuiTableFlags_BordersH); static bool show_headers = false; ImGui::Checkbox("show_headers", &show_headers); PopStyleCompact(); + ImGui::PopID(); if (ImGui::BeginTable("table_padding", 3, flags1)) { @@ -6410,7 +6414,7 @@ static void DemoWindowTables() HelpMarker("Setting style.CellPadding to (0,0) or a custom value."); static ImGuiTableFlags flags2 = ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg; static ImVec2 cell_padding(0.0f, 0.0f); - static bool show_widget_frame_bg = true; + static bool show_widget_frame_bg = false; PushStyleCompact(); ImGui::CheckboxFlags("ImGuiTableFlags_Borders", &flags2, ImGuiTableFlags_Borders); From 135a923659ba2b475f06909bcda8877641a928b5 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 9 Nov 2026 12:51:07 +0100 Subject: [PATCH 62/72] Demo: remove some hardcoded sizes. --- imgui_demo.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index d25f6e560..4a9753a89 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -4652,6 +4652,8 @@ static void DemoWindowLayout() IMGUI_DEMO_MARKER("Layout/Child windows"); ImGui::SeparatorText("Child windows"); + const float ref_sz = ImGui::GetTextLineHeightWithSpacing(); + HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window."); static bool disable_mouse_wheel = false; static bool disable_menu = false; @@ -4663,7 +4665,7 @@ static void DemoWindowLayout() ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar; if (disable_mouse_wheel) window_flags |= ImGuiWindowFlags_NoScrollWithMouse; - ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 260), ImGuiChildFlags_None, window_flags); + ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 15 * ref_sz), ImGuiChildFlags_None, window_flags); for (int i = 0; i < 100; i++) ImGui::Text("%04d: scrollable region", i); ImGui::EndChild(); @@ -4679,7 +4681,7 @@ static void DemoWindowLayout() if (!disable_menu) window_flags |= ImGuiWindowFlags_MenuBar; ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); - ImGui::BeginChild("ChildR", ImVec2(0, 260), ImGuiChildFlags_Borders, window_flags); + ImGui::BeginChild("ChildR", ImVec2(0, 15 * ref_sz), ImGuiChildFlags_Borders, window_flags); if (!disable_menu && ImGui::BeginMenuBar()) { if (ImGui::BeginMenu("Menu")) @@ -4708,11 +4710,11 @@ static void DemoWindowLayout() ImGui::SeparatorText("Manual-resize"); { HelpMarker("Drag bottom border to resize. Double-click bottom border to auto-fit to vertical contents."); - //if (ImGui::Button("Set Height to 200")) - // ImGui::SetNextWindowSize(ImVec2(-FLT_MIN, 200.0f)); + //if (ImGui::Button("Set Height to 300")) + // ImGui::SetNextWindowSize(ImVec2(-FLT_MIN, 300.0f)); ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_FrameBg)); - if (ImGui::BeginChild("ResizableChild", ImVec2(-FLT_MIN, ImGui::GetTextLineHeightWithSpacing() * 8), ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeY)) + if (ImGui::BeginChild("ResizableChild", ImVec2(-FLT_MIN, ref_sz * 8), ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeY)) for (int n = 0; n < 10; n++) ImGui::Text("Line %04d", n); ImGui::PopStyleColor(); @@ -4724,12 +4726,12 @@ static void DemoWindowLayout() { static int draw_lines = 3; static int max_height_in_lines = 10; - ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8); + ImGui::SetNextItemWidth(ref_sz * 7); ImGui::DragInt("Lines Count", &draw_lines, 0.2f); - ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8); + ImGui::SetNextItemWidth(ref_sz * 7); ImGui::DragInt("Max Height (in Lines)", &max_height_in_lines, 0.2f); - ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 1), ImVec2(FLT_MAX, ImGui::GetTextLineHeightWithSpacing() * max_height_in_lines)); + ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, ref_sz * 1), ImVec2(FLT_MAX, ref_sz * max_height_in_lines)); if (ImGui::BeginChild("ConstrainedChild", ImVec2(-FLT_MIN, 0.0f), ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY)) for (int n = 0; n < draw_lines; n++) ImGui::Text("Line %04d", n); @@ -4749,7 +4751,7 @@ static void DemoWindowLayout() static int offset_x = 0; static bool override_bg_color = true; static ImGuiChildFlags child_flags = ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeX | ImGuiChildFlags_ResizeY; - ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8); + ImGui::SetNextItemWidth(ref_sz * 7); ImGui::DragInt("Offset X", &offset_x, 1.0f, -1000, 1000); ImGui::Checkbox("Override ChildBg color", &override_bg_color); ImGui::CheckboxFlags("ImGuiChildFlags_Borders", &child_flags, ImGuiChildFlags_Borders); @@ -4764,7 +4766,7 @@ static void DemoWindowLayout() ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (float)offset_x); if (override_bg_color) ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(255, 0, 0, 100)); - ImGui::BeginChild("Red", ImVec2(200, 100), child_flags, ImGuiWindowFlags_None); + ImGui::BeginChild("Red", ImVec2(ref_sz * 12.0f, ref_sz * 6.0f), child_flags, ImGuiWindowFlags_None); if (override_bg_color) ImGui::PopStyleColor(); @@ -4861,7 +4863,7 @@ static void DemoWindowLayout() if (show_indented_items) { ImGui::Indent(); - ImGui::DragFloat("float (indented)##6b", &f); + ImGui::DragFloat("##float6b (indented)", &f); ImGui::Unindent(); } ImGui::PopItemWidth(); @@ -4926,7 +4928,8 @@ static void DemoWindowLayout() static int selection[4] = { 0, 1, 2, 3 }; for (int i = 0; i < 4; i++) { - if (i > 0) ImGui::SameLine(); + if (i > 0) + ImGui::SameLine(); ImGui::PushID(i); ImGui::ListBox("", &selection[i], items, IM_COUNTOF(items)); ImGui::PopID(); @@ -4934,9 +4937,11 @@ static void DemoWindowLayout() } ImGui::PopItemWidth(); + const float ref_sz = ImGui::GetTextLineHeightWithSpacing(); + // Dummy IMGUI_DEMO_MARKER("Layout/Basic Horizontal Layout/Dummy"); - ImVec2 button_sz(40, 40); + ImVec2 button_sz(ref_sz * 3.0f, ref_sz * 3.0f); ImGui::Button("A", button_sz); ImGui::SameLine(); ImGui::Dummy(button_sz); ImGui::SameLine(); ImGui::Button("B", button_sz); @@ -5078,9 +5083,9 @@ static void DemoWindowLayout() ImGui::Indent(); // SmallButton() sets FramePadding to zero. Text baseline is aligned to match baseline of previous Button. - ImGui::Button("80x80", ImVec2(80, 80)); + ImGui::Button("120x120", ImVec2(120, 120)); ImGui::SameLine(); - ImGui::Button("50x50", ImVec2(50, 50)); + ImGui::Button("80x80", ImVec2(80, 80)); ImGui::SameLine(); ImGui::Button("Button()"); ImGui::SameLine(); From 022499b0ce9d7301a8ef9f3e4de75688c09f4279 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 9 Nov 2026 13:10:56 +0100 Subject: [PATCH 63/72] Checkbox: indeterminate/mixed value inner rectangle never has rounding, to reduce confusion with a radio button. (#5518, #5677, #6865, #2644) Amend 2a3517a3998 --- docs/CHANGELOG.txt | 2 ++ imgui_widgets.cpp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index a58b03b6b..da5b2a697 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -98,6 +98,8 @@ Other Changes: end of storage when trailing items are unselected (#9604) [@MilosLord] - Drags: fixed handling of `ImGuiSliderFlags_WrapAround`: value could temporarily escape the range when dragging fast. (#9612, #9611, #7749) [@swayie, @ocornut] +- Checkbox: indeterminate/mixed value inner rectangle never has rounding, + to reduce confusion with a radio button. (#5518, #5677, #6865, #2644) - ColorEdit: - ColorButton, ColorEdit, ColorPicker: fixed an issue rendering colors when inside a `BeginDisabled(false)` block, caused by the alpha cancelling-out diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 91f0d0f61..3d3d1f008 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1299,8 +1299,9 @@ bool ImGui::Checkbox(const char* label, bool* v) { // Undocumented tristate/mixed/indeterminate checkbox (#2644) // This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox) - ImVec2 pad(ImMax(1.0f, IM_TRUNC(square_sz / 3.6f)), ImMax(1.0f, IM_TRUNC(square_sz / 3.6f))); - window->DrawList->AddRectFilled(check_bb.Min + pad, check_bb.Max - pad, check_col, style.FrameRounding); + const float pad = ImMax(1.0f, IM_TRUNC(square_sz / 3.6f)); + const float rounding = 0.0f;// IM_TRUNC(ImMin((square_sz - pad * 2.0f) * 0.20f, style.FrameRounding)); // Clamp rounding + window->DrawList->AddRectFilled(check_bb.Min + ImVec2(pad, pad), check_bb.Max - ImVec2(pad, pad), check_col, rounding); } else if (*v) { From 3aae2df9f6e5a0fe721e09f23b6e82906a7468f8 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 9 Nov 2026 13:14:40 +0100 Subject: [PATCH 64/72] Style: StyleColorsDark(): tweaked PopupBg, ChildBg, to be darker than in 1.93.0. --- docs/CHANGELOG.txt | 2 +- imgui_draw.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index da5b2a697..f54edf32c 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -67,7 +67,7 @@ Autumn cleanup of stuff marked obsolete more than two years ago: Other Changes: - Style: - - `StyleColorsDark()`: tweaked WindowBg to be darker than in 1.93.0. + - `StyleColorsDark()`: tweaked WindowBg, PopupBg, ChildBg to be darker than in 1.93.0. - Added `style.SymbolArrowSizeFactor`, `style.SymbolArrowThicknessFactor` to tweak the shape and look of arrows. Made default arrow stroked. (#5233, #2431, #2235, #6730, #8243) Legacy arrow: size: (0.60f,0.70f), thickness: 0.0f diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 6d8e3f224..c576e5018 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -192,8 +192,8 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst) colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.58f, 0.58f, 0.58f, 1.00f); colors[ImGuiCol_WindowBg] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); - colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); - colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f); + colors[ImGuiCol_ChildBg] = ImVec4(0.17f, 0.17f, 0.17f, 0.00f); + colors[ImGuiCol_PopupBg] = ImVec4(0.14f, 0.14f, 0.14f, 0.94f); colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); colors[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); From 5554e8e4768b367003cb97b23c11e16063e86a32 Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Mon, 9 Nov 2026 13:30:01 +0100 Subject: [PATCH 65/72] Backends: GLFW, SDL2: Emscripten's OpenURL() passes 'noopener' to window.open(). (#9615, #7660, #7851) The new tab opened by window.open(url, '_blank') keeps a reference to our page (window.opener). With a "javascript:" url, the script runs in a blank page of the same origin, with full access to ours: a document rendered with TextLinkOpenURL() could carry such a link. 'noopener' removes that reference. --- backends/imgui_impl_glfw.cpp | 2 +- backends/imgui_impl_sdl2.cpp | 2 +- docs/CHANGELOG.txt | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backends/imgui_impl_glfw.cpp b/backends/imgui_impl_glfw.cpp index 678129a07..2be125300 100644 --- a/backends/imgui_impl_glfw.cpp +++ b/backends/imgui_impl_glfw.cpp @@ -663,7 +663,7 @@ void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows) #if EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3 >= 34020240817 void ImGui_ImplGlfw_EmscriptenOpenURL(const char* url) { if (url) emscripten::glfw3::OpenURL(url); } #else -EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (const char* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); }); +EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (const char* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank', 'noopener'); }); #endif #endif diff --git a/backends/imgui_impl_sdl2.cpp b/backends/imgui_impl_sdl2.cpp index a93bcc29e..d5ba4dade 100644 --- a/backends/imgui_impl_sdl2.cpp +++ b/backends/imgui_impl_sdl2.cpp @@ -507,7 +507,7 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event) } #ifdef __EMSCRIPTEN__ -EM_JS(void, ImGui_ImplSDL2_EmscriptenOpenURL, (char const* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); }); +EM_JS(void, ImGui_ImplSDL2_EmscriptenOpenURL, (char const* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank', 'noopener'); }); #endif static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer, void* sdl_gl_context) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index f54edf32c..f310858aa 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -112,6 +112,10 @@ Other Changes: to reflect that they can also build X64 or ARM64, given the right environment. Made the script detect the environment when needed (e.g. to specify library path). - Examples: added support for ARM64 in selected build_win.bat helpers. (#9593) [@Harishmcw] +- Backends: + - GLFW, SDL2: Emscripten implementation of `Platform_OpenInShellFn` calls + `window.open()` with `noopener`: prevents newly opened tab from keeping a + reference to opening page. (#9615, #7660, #7851) [@pthom] ----------------------------------------------------------------------- From 8ba9eb061f64f5363833c590f16f2308f02f2f66 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 9 Nov 2026 16:05:00 +0100 Subject: [PATCH 66/72] Internals, Inputs: declaring FindLatestInputEvent() in imgui_internal.h. Might facilitate late-latching experiments? (#9594) --- imgui.cpp | 12 ++++++------ imgui_internal.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 4519c96fb..10a13b56a 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1920,7 +1920,7 @@ void ImGuiIO::ClearInputMouse() MouseWheel = MouseWheelH = 0.0f; } -static ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1) +ImGuiInputEvent* ImGui::FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg) { ImGuiContext& g = *ctx; for (int n = g.InputEventsQueue.Size - 1; n >= 0; n--) @@ -1965,7 +1965,7 @@ void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value) } // Filter duplicate (in particular: key mods and gamepad analog values are commonly spammed) - const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_Key, (int)key); + const ImGuiInputEvent* latest_event = ImGui::FindLatestInputEvent(&g, ImGuiInputEventType_Key, (int)key); const ImGuiKeyData* key_data = ImGui::GetKeyData(&g, key); const bool latest_key_down = latest_event ? latest_event->Key.Down : key_data->Down; const float latest_key_analog = latest_event ? latest_event->Key.AnalogValue : key_data->AnalogValue; @@ -2023,7 +2023,7 @@ void ImGuiIO::AddMousePosEvent(float x, float y) ImVec2 pos((x > -FLT_MAX) ? ImFloor(x) : x, (y > -FLT_MAX) ? ImFloor(y) : y); // Filter duplicate - const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_MousePos); + const ImGuiInputEvent* latest_event = ImGui::FindLatestInputEvent(&g, ImGuiInputEventType_MousePos); const ImVec2 latest_pos = latest_event ? ImVec2(latest_event->MousePos.PosX, latest_event->MousePos.PosY) : g.IO.MousePos; if (latest_pos.x == pos.x && latest_pos.y == pos.y) return; @@ -2056,7 +2056,7 @@ void ImGuiIO::AddMouseButtonEvent(int mouse_button, bool down) } // Filter duplicate - const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_MouseButton, (int)mouse_button); + const ImGuiInputEvent* latest_event = ImGui::FindLatestInputEvent(&g, ImGuiInputEventType_MouseButton, (int)mouse_button); const bool latest_button_down = latest_event ? latest_event->MouseButton.Down : g.IO.MouseDown[mouse_button]; if (latest_button_down == down) return; @@ -2066,7 +2066,7 @@ void ImGuiIO::AddMouseButtonEvent(int mouse_button, bool down) // - At this point we want from !down to down, so this is handling the initial press. if (ConfigMacOSXBehaviors && mouse_button == 0 && down) { - const ImGuiInputEvent* latest_super_event = FindLatestInputEvent(&g, ImGuiInputEventType_Key, (int)ImGuiMod_Super); + const ImGuiInputEvent* latest_super_event = ImGui::FindLatestInputEvent(&g, ImGuiInputEventType_Key, (int)ImGuiMod_Super); if (latest_super_event ? latest_super_event->Key.Down : g.IO.KeySuper) { IMGUI_DEBUG_LOG_IO("[io] Super+Left Click aliased into Right Click\n"); @@ -2121,7 +2121,7 @@ void ImGuiIO::AddFocusEvent(bool focused) ImGuiContext& g = *Ctx; // Filter duplicate - const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_Focus); + const ImGuiInputEvent* latest_event = ImGui::FindLatestInputEvent(&g, ImGuiInputEventType_Focus); const bool latest_focused = latest_event ? latest_event->AppFocused.Focused : !g.IO.AppFocusLost; if (latest_focused == focused || (ConfigDebugIgnoreFocusLoss && !focused)) return; diff --git a/imgui_internal.h b/imgui_internal.h index add0b8ce1..d679e48f9 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -3499,6 +3499,7 @@ namespace ImGui IMGUI_API void StopMouseMovingWindow(); IMGUI_API void UpdateMouseMovingWindowNewFrame(); IMGUI_API void UpdateMouseMovingWindowEndFrame(); + IMGUI_API ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1); // Viewports inline ImGuiViewport* GetWindowViewport() { return GetMainViewport(); } // For code consistency. This is public API in docking branch. From c9a52f48e9e88b3fc920aae271e20290431b5357 Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Mon, 9 Nov 2026 17:27:21 +0100 Subject: [PATCH 67/72] Backends: SDL2: on iOS, call SDL_StartTextInput()/SDL_StopTextInput() again. (#7636, #9474, #9617) --- backends/imgui_impl_sdl2.cpp | 9 +++++---- docs/CHANGELOG.txt | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/backends/imgui_impl_sdl2.cpp b/backends/imgui_impl_sdl2.cpp index d5ba4dade..8281fa4ed 100644 --- a/backends/imgui_impl_sdl2.cpp +++ b/backends/imgui_impl_sdl2.cpp @@ -21,8 +21,9 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2026-11-09: Inputs: iOS: restore SDL_StartTextInput()/SDL_StopTextInput() in IME handler for on-screen keyboard support. (#7636, #9474, #9617) // 2026-08-06: Fixed querying framebuffer scale when using Metal. (#5592) -// 2026-07-15: Inputs: restore SDL_StartTextInput()/SDL_StopTextInput() in IME handler for on-screen keyboard support on Android/mobile. (#7636, #9474) +// 2026-07-15: Inputs: Android: restore SDL_StartTextInput()/SDL_StopTextInput() in IME handler for on-screen keyboard support. (#7636, #9474) // 2026-04-16: Made ImGui_ImplSDL2_GetContentScaleForWindow(), ImGui_ImplSDL2_GetContentScaleForDisplay() helpers return a minimum of 1.0f, as some Linux setup seems to report <1.0f value and this breaks scaling border size. (#9369) // 2026-02-13: Inputs: systems other than X11 are back to starting mouse capture on mouse down (reverts 2025-02-26 change). Only X11 requires waiting for a drag by default (not ideal, but a better default for X11 users). Added ImGui_ImplSDL2_SetMouseCaptureMode() for X11 debugger users. (#3650, #6410, #9235) // 2026-01-15: Changed GetClipboardText() handler to return nullptr on error aka clipboard contents is not text. Consistent with other backends. (#9168) @@ -216,15 +217,15 @@ static void ImGui_ImplSDL2_PlatformSetImeData(ImGuiContext*, ImGuiViewport*, ImG r.h = (int)data->InputLineHeight; SDL_SetTextInputRect(&r); -#ifdef __ANDROID__ - // SDL_StartTextInput() is needed on Android (and some other platforms) to show the on-screen keyboard. (#7636, #9474, #6306) +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + // SDL_StartTextInput() is needed on Android and iOS to show the on-screen keyboard. (#7636, #9474, #6306) // It was removed in a7703fe6 due to concerns about its relation to desktop IME, but is required on mobile. SDL_StartTextInput(); #endif } else { -#ifdef __ANDROID__ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) SDL_StopTextInput(); #endif } diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index f310858aa..5b15f168c 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -114,8 +114,11 @@ Other Changes: - Examples: added support for ARM64 in selected build_win.bat helpers. (#9593) [@Harishmcw] - Backends: - GLFW, SDL2: Emscripten implementation of `Platform_OpenInShellFn` calls - `window.open()` with `noopener`: prevents newly opened tab from keeping a - reference to opening page. (#9615, #7660, #7851) [@pthom] + `window.open()` with `noopener`: prevents newly opened tab from keeping a + reference to opening page. (#9615, #7660, #7851) [@pthom] + - SDL2: on iOS, also restore calling `SDL_StartTextInput()/SDL_StopTextInput()` + in IME handler. Match Android change in 1.93.0. [@pthom] (#7636, #9474, #9617) + ----------------------------------------------------------------------- From c150bcee03ff1c134594aa872b1dda55a863471a Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 10 Nov 2026 16:57:14 +0100 Subject: [PATCH 68/72] Fonts: detect if the parameters leading AddFontDefault() to implicitly select either AddFontDefaultBitmap() or AddFontDefaultVector() have changed. (#9591) --- docs/CHANGELOG.txt | 4 ++++ imgui.cpp | 8 ++++++++ imgui_draw.cpp | 24 ++++++++++++++++-------- imgui_internal.h | 6 ++++-- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 5b15f168c..bed8b58bf 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -104,6 +104,10 @@ Other Changes: - ColorButton, ColorEdit, ColorPicker: fixed an issue rendering colors when inside a `BeginDisabled(false)` block, caused by the alpha cancelling-out code in 1.93.0. (#9511, #9613, #9614) [@tksuoran] +- Fonts: + - Detect if the parameters leading `AddFontDefault()` to implicitly select either + `AddFontDefaultBitmap()` or `AddFontDefaultVector()` have changed between init + time and first frame. (#9591) - ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2. This isn't supported but should not be needed as you should have a constructor to convert from your type to ImVec2. diff --git a/imgui.cpp b/imgui.cpp index 10a13b56a..be3249748 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -11259,6 +11259,14 @@ static void ImGui::ErrorCheckNewFrameSanityChecks() if (g.IO.ConfigErrorRecovery) IM_ASSERT(g.IO.ConfigErrorRecoveryEnableAssert || g.IO.ConfigErrorRecoveryEnableDebugLog || g.IO.ConfigErrorRecoveryEnableTooltip || g.ErrorCallback != NULL); + // Detect if the parameters leading AddFontDefault() to implicitly select either AddFontDefaultBitmap() or AddFontDefaultVector() have changed. + if (g.FrameCount == 2 && g.IO.Fonts->Builder->LoadedFontDefaultAsVector != -1) + { + const bool old_heuristic_result_for_using_vector_font = (bool)g.IO.Fonts->Builder->LoadedFontDefaultAsVector; + const bool new_heuristic_result_for_using_vector_font = ImFontAtlasHeuristicShouldUseDefaultVectorFont(g.IO.Fonts); + IM_ASSERT_USER_ERROR(old_heuristic_result_for_using_vector_font == new_heuristic_result_for_using_vector_font, "AddFontDefault() font selection heuristic parameters changed between load/init time and now. Verify which parameters have changed or load a default font explicitly!"); + } + #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS if (g.IO.FontGlobalScale > 1.0f) IM_ASSERT(g.Style.FontScaleMain == 1.0f && "Since 1.92: use style.FontScaleMain instead of g.IO.FontGlobalScale!"); diff --git a/imgui_draw.cpp b/imgui_draw.cpp index c576e5018..59347e56f 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -4363,7 +4363,10 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg_in) ImFontAtlasFontSourceAddToFont(this, font, font_cfg); if (is_first_font) + { ImFontAtlasBuildNotifySetFont(this, NULL, font); + Builder->LoadedFontDefaultAsVector = -1; + } return font; } @@ -4389,13 +4392,17 @@ const char* ImGui_GetDefaultCompressedFontDataProggyForever(int* out_size); #endif // This duplicates some of the logic in UpdateFontsNewFrame() which is a bit chicken-and-eggy/tricky to extract due to variety of codepaths and possible initialization ordering. -static float GetExpectedContextFontSize(ImGuiContext* ctx) +bool ImFontAtlasHeuristicShouldUseDefaultVectorFont(ImFontAtlas* atlas) { + ImGuiContext* ctx = atlas->OwnerContext; + if (ctx == NULL) + return true; float fb_scale = (ctx->IO.DisplayFramebufferScale.x != 0.0f) ? ctx->IO.DisplayFramebufferScale.x : 1.0f; if (ctx->IO.DisplayFramebufferScale.x == 1.0f && ctx->IO.DisplaySize.x <= 0.0f && ctx->IO.ConfigMacOSXBehaviors) - fb_scale = 2.0f; // If called before backend had a chance to init DisplayFramebufferScale. default to expecting Retina. - float scale = ctx->Style.FontScaleMain * ctx->Style.FontScaleDpi * fb_scale; - return ((ctx->Style.FontSizeBase > 0.0f) ? ctx->Style.FontSizeBase : 13.0f) * scale; + fb_scale = 2.0f; // If called before backend had a chance to init DisplayFramebufferScale: default to expecting Retina on macOS/iOS. + const float scale = ctx->Style.FontScaleMain * ctx->Style.FontScaleDpi * fb_scale; + const float expected_font_size = ((ctx->Style.FontSizeBase > 0.0f) ? ctx->Style.FontSizeBase : 13.0f) * scale; + return expected_font_size >= 15.0f; } // Legacy function with heuristic to select Pixel or Vector font. @@ -4403,10 +4410,11 @@ static float GetExpectedContextFontSize(ImGuiContext* ctx) // Prefer calling AddFontDefaultVector() or AddFontDefaultBitmap() based on your own logic. ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg) { - if (OwnerContext == NULL || GetExpectedContextFontSize(OwnerContext) >= 15.0f) - return AddFontDefaultVector(font_cfg); - else - return AddFontDefaultBitmap(font_cfg); + const bool use_vector_font = ImFontAtlasHeuristicShouldUseDefaultVectorFont(this); + ImFont* font = use_vector_font ? AddFontDefaultVector(font_cfg) : AddFontDefaultBitmap(font_cfg); + if (Fonts.Size == 1) + Builder->LoadedFontDefaultAsVector = use_vector_font ? 1 : 0; + return font; } // Load embedded ProggyClean.ttf. Default size 13, disable oversampling. diff --git a/imgui_internal.h b/imgui_internal.h index d679e48f9..1bb0ebcd6 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -4086,7 +4086,8 @@ struct ImFontAtlasBuilder ImVec2i MaxRectSize; // Largest rectangle to pack (de-facto used as a "minimum texture size") ImVec2i MaxRectBounds; // Bottom-right most used pixels bool LockDisableResize; // Disable resizing texture - bool PreloadedAllGlyphsRanges; // Set when missing ImGuiBackendFlags_RendererHasTextures features forces atlas to preload everything. + bool PreloadedAllGlyphsRanges; // Set when missing ImGuiBackendFlags_RendererHasTextures features forces atlas to preload everything. + ImS8 LoadedFontDefaultAsVector; // -1, or record with 0/1 whereas AddFontDefault() picked bitmap or vector font. // Cache of all ImFontBaked ImStableVector BakedPool; @@ -4103,7 +4104,7 @@ struct ImFontAtlasBuilder ImVec4 TexUvLines[IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1 + IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH_COUNT]; // UVs for baked anti-aliased lines (u0, u1, v, 1/thickness) ImVec4 TexUvCorners[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX * IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]; // UVs for baked anti-aliased corners (0= fill, 1> stroke thickness) - ImFontAtlasBuilder() { memset((void*)this, 0, sizeof(*this)); FrameCount = -1; RectsIndexFreeListStart = -1; PackIdMouseCursors = PackIdLinesTexData = PackIdLineFractTexData = PackIdCornersTexData = -1; } + ImFontAtlasBuilder() { memset((void*)this, 0, sizeof(*this)); FrameCount = -1; RectsIndexFreeListStart = -1; LoadedFontDefaultAsVector = -1; PackIdMouseCursors = PackIdLinesTexData = PackIdLineFractTexData = PackIdCornersTexData = -1; } }; IMGUI_API void ImFontAtlasBuildInit(ImFontAtlas* atlas); @@ -4158,6 +4159,7 @@ IMGUI_API void ImFontAtlasAddDrawListSharedData(ImFontAtlas* atlas, IMGUI_API void ImFontAtlasRemoveDrawListSharedData(ImFontAtlas* atlas, ImDrawListSharedData* data); IMGUI_API void ImFontAtlasUpdateDrawListsTextures(ImFontAtlas* atlas, ImTextureRef old_tex, ImTextureRef new_tex); IMGUI_API void ImFontAtlasUpdateDrawListsSharedData(ImFontAtlas* atlas); +IMGUI_API bool ImFontAtlasHeuristicShouldUseDefaultVectorFont(ImFontAtlas* atlas); IMGUI_API void ImFontAtlasTextureBlockConvert(const unsigned char* src_pixels, ImTextureFormat src_fmt, int src_pitch, unsigned char* dst_pixels, ImTextureFormat dst_fmt, int dst_pitch, int w, int h); IMGUI_API void ImFontAtlasTextureBlockPostProcess(ImFontAtlasPostProcessData* data); From 4cb4b17cb5db3d9c581c4c5d539802303e7e9777 Mon Sep 17 00:00:00 2001 From: sarpsenturk Date: Wed, 23 Sep 2026 23:15:57 +0300 Subject: [PATCH 69/72] Backends: Vulkan: don't transition swapchain images before acquire. (#9553, #9496) cc #9152 --- backends/imgui_impl_vulkan.cpp | 77 +--------------------------------- docs/CHANGELOG.txt | 3 ++ 2 files changed, 5 insertions(+), 75 deletions(-) diff --git a/backends/imgui_impl_vulkan.cpp b/backends/imgui_impl_vulkan.cpp index 7017a6fd1..f44581030 100644 --- a/backends/imgui_impl_vulkan.cpp +++ b/backends/imgui_impl_vulkan.cpp @@ -27,6 +27,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2026-11-10: Don't transition swapchain images from VK_IMAGE_LAYOUT_UNDEFINED to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR` on window creation, prevent validation errors in examples and multi-viewport support. (#9553, #9496) // 2026-10-06: Added support for dynamic rendering with multiple color attachments (PipelineRenderingCreateInfo.colorAttachmentCount > 1): we render to the first one and leave the others untouched. (#9574) // 2026-09-07: Round framebuffer dimensions to the nearest integer instead of truncating them. (#9538, 9515, #8628) // 2026-09-03: Added for support for multiple Vulkan contexts with custom loaders. (#6616) @@ -1918,6 +1919,7 @@ void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, V // Create or resize window // - 2025/09/26: v1.92.4 added a trailing 'VkImageUsageFlags image_usage' parameter which is usually VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT. +// - 2026/11/10: v1.93.1 removed a bunch of code transitioning swapchain image layout from `VK_IMAGE_LAYOUT_UNDEFINED` to `VK_IMAGE_LAYOUT_PRESENT_SRC_KHR`. (#9496) void ImGui_ImplVulkanH_CreateOrResizeWindow(VkInstance instance, VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wd, uint32_t queue_family, const VkAllocationCallbacks* allocator, int width, int height, uint32_t min_image_count, VkImageUsageFlags image_usage) { IM_ASSERT(g_FunctionsLoaded && "Need to call ImGui_ImplVulkan_LoadFunctions() if IMGUI_IMPL_VULKAN_NO_PROTOTYPES or VK_NO_PROTOTYPES are set!"); @@ -1926,81 +1928,6 @@ void ImGui_ImplVulkanH_CreateOrResizeWindow(VkInstance instance, VkPhysicalDevic ImGui_ImplVulkanH_CreateWindowSwapChain(physical_device, device, wd, allocator, width, height, min_image_count, image_usage); ImGui_ImplVulkanH_CreateWindowCommandBuffers(physical_device, device, wd, queue_family, allocator); - - // FIXME: to submit the command buffer, we need a queue. In the examples folder, the ImGui_ImplVulkanH_CreateOrResizeWindow function is called - // before the ImGui_ImplVulkan_Init function, so we don't have access to the queue yet. Here we have the queue_family that we can use to grab - // a queue from the device and submit the command buffer. It would be better to have access to the queue as suggested in the FIXME below. - VkCommandPool command_pool; - VkCommandPoolCreateInfo pool_info = {}; - pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; - pool_info.queueFamilyIndex = queue_family; - VkResult err = vkCreateCommandPool(device, &pool_info, allocator, &command_pool); - check_vk_result(err); - - VkFenceCreateInfo fence_info = {}; - fence_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; - VkFence fence; - err = vkCreateFence(device, &fence_info, allocator, &fence); - check_vk_result(err); - - VkCommandBufferAllocateInfo alloc_info = {}; - alloc_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; - alloc_info.commandPool = command_pool; - alloc_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; - alloc_info.commandBufferCount = 1; - VkCommandBuffer command_buffer; - err = vkAllocateCommandBuffers(device, &alloc_info, &command_buffer); - check_vk_result(err); - - VkCommandBufferBeginInfo begin_info = {}; - begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; - begin_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; - err = vkBeginCommandBuffer(command_buffer, &begin_info); - check_vk_result(err); - - // Transition the images to the correct layout for rendering - for (uint32_t i = 0; i < wd->ImageCount; i++) - { - VkImageMemoryBarrier barrier = {}; - barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barrier.image = wd->Frames[i].Backbuffer; - barrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - barrier.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barrier.subresourceRange.levelCount = 1; - barrier.subresourceRange.layerCount = 1; - vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); - } - - err = vkEndCommandBuffer(command_buffer); - check_vk_result(err); - VkSubmitInfo submit_info = {}; - submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; - submit_info.commandBufferCount = 1; - submit_info.pCommandBuffers = &command_buffer; - - VkQueue queue; - vkGetDeviceQueue(device, queue_family, 0, &queue); - err = vkQueueSubmit(queue, 1, &submit_info, fence); - check_vk_result(err); - err = vkWaitForFences(device, 1, &fence, VK_TRUE, UINT64_MAX); - check_vk_result(err); - err = vkResetFences(device, 1, &fence); - check_vk_result(err); - - err = vkResetCommandPool(device, command_pool, 0); - check_vk_result(err); - - // Destroy command buffer and fence and command pool - vkFreeCommandBuffers(device, command_pool, 1, &command_buffer); - vkDestroyCommandPool(device, command_pool, allocator); - vkDestroyFence(device, fence, allocator); - command_pool = VK_NULL_HANDLE; - command_buffer = VK_NULL_HANDLE; - fence = VK_NULL_HANDLE; - queue = VK_NULL_HANDLE; } void ImGui_ImplVulkanH_DestroyWindow(VkInstance instance, VkDevice device, ImGui_ImplVulkanH_Window* wd, const VkAllocationCallbacks* allocator) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index bed8b58bf..12ebcac84 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -122,6 +122,9 @@ Other Changes: reference to opening page. (#9615, #7660, #7851) [@pthom] - SDL2: on iOS, also restore calling `SDL_StartTextInput()/SDL_StopTextInput()` in IME handler. Match Android change in 1.93.0. [@pthom] (#7636, #9474, #9617) + - Vulkan: don't transition swapchain images from `VK_IMAGE_LAYOUT_UNDEFINED` to + `VK_IMAGE_LAYOUT_PRESENT_SRC_KHR` on window creation, prevent validation errors in + examples and multi-viewport support. (#9553, #9496, #9152) [@sarpsenturk, @LewisJustin] From 1dc17c426bc1f458bf0db95df30c33f9b94a4f21 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 30 Aug 2026 20:59:44 +0200 Subject: [PATCH 70/72] Tables: minor: refactor use TableInitColumnDefaults() in TableApplyQueuedRequests() for consistency. --- imgui_tables.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index f7a39f689..363e36806 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -708,7 +708,7 @@ void ImGui::TableApplyQueuedRequests(ImGuiTable* table) // Handle display order / visibility reset requests if (table->IsResetDisplayOrderRequest) { - for (int n = 0; n < table->ColumnsCount; n++) + for (int n = 0; n < table->ColumnsCount; n++) // Variant of using TableInitColumnDefaults()( table->DisplayOrderToIndex[n] = table->Columns[n].DisplayOrder = (ImGuiTableColumnIdx)n; table->IsResetDisplayOrderRequest = false; table->IsSettingsDirty = true; @@ -716,7 +716,7 @@ void ImGui::TableApplyQueuedRequests(ImGuiTable* table) if (table->IsResetVisibilityRequest) { for (ImGuiTableColumn& column : table->Columns) - column.IsUserEnabled = column.IsUserEnabledNextFrame = (column.Flags & ImGuiTableColumnFlags_DefaultHide) ? 0 : 1; + TableInitColumnDefaults(table, &column, ImGuiTableFlags_Hideable); table->IsResetVisibilityRequest = false; table->IsSettingsDirty = true; } @@ -1685,7 +1685,7 @@ void ImGui::TableInitColumnDefaults(ImGuiTable* table, ImGuiTableColumn* column, if (init_mask & ImGuiTableFlags_Resizable) { float init_width_or_weight = column->InitStretchWeightOrWidth; - column->WidthRequest = ((flags & ImGuiTableColumnFlags_WidthFixed) && init_width_or_weight > 0.0f) ? init_width_or_weight : -1.0f; + column->WidthRequest = (init_width_or_weight > 0.0f && (flags & ImGuiTableColumnFlags_WidthFixed)) ? init_width_or_weight : -1.0f; column->StretchWeight = (init_width_or_weight > 0.0f && (flags & ImGuiTableColumnFlags_WidthStretch)) ? init_width_or_weight : -1.0f; if (init_width_or_weight > 0.0f) // Disable auto-fit if an explicit width/weight has been specified column->AutoFitQueue = 0x00; From ac3b6c34e3f7a9020afac7bb0f326f2395e57352 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 10 Nov 2026 18:42:09 +0100 Subject: [PATCH 71/72] Tables: added "Reset->Reset Sizes" context-menu option. Rename mixed sizing policy entry"Size all columns to auto". (#9523, #9605) Amend Demo->Columns Widths to showcase. --- docs/CHANGELOG.txt | 1 + imgui.cpp | 3 ++- imgui.h | 2 +- imgui_demo.cpp | 30 +++++++++++++++++++++--------- imgui_internal.h | 2 ++ imgui_tables.cpp | 15 +++++++++++++-- 6 files changed, 40 insertions(+), 13 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 12ebcac84..b311df197 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -82,6 +82,7 @@ Other Changes: - Modals: fixed an assert displaying a modal in an environment where `io.DisplayFramebufferScale` is not an integer (regression in 1.93.0). (#9598) - Tables: + - Added "Reset->Reset Sizes" context-menu option. (#9523, #9605) - Fixed various border overshooting issues, some mostly visible with transparent borders and under specific conditions: (#4678) - On non-scrolling tables, inner horizontal borders slightly overlapped diff --git a/imgui.cpp b/imgui.cpp index be3249748..e2aea63d4 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4305,11 +4305,12 @@ static const ImGuiLocEntry GLocalizationEntriesEnUS[] = { ImGuiLocKey_VersionStr, "Dear ImGui " IMGUI_VERSION " (" IM_STRINGIFY(IMGUI_VERSION_NUM) ")" }, { ImGuiLocKey_TableSizeOne, "Size column to fit###SizeOne" }, { ImGuiLocKey_TableSizeAllFit, "Size all columns to fit###SizeAll" }, - { ImGuiLocKey_TableSizeAllDefault, "Size all columns to default###SizeAll" }, + { ImGuiLocKey_TableSizeAllDefault, "Size all columns to auto###SizeAll" }, { ImGuiLocKey_TableReset, "Reset" }, //{ ImGuiLocKey_TableResetAll, "Reset to default###ResetAll" }, { ImGuiLocKey_TableResetOrder, "Reset order###ResetOrder" }, { ImGuiLocKey_TableResetVisibility, "Reset visibility###ResetVisibility" }, + { ImGuiLocKey_TableResetSizing, "Reset sizing###ResetSizing" }, { ImGuiLocKey_WindowingMainMenuBar, "(Main menu bar)" }, { ImGuiLocKey_WindowingPopup, "(Popup)" }, { ImGuiLocKey_WindowingUntitled, "(Untitled)" }, diff --git a/imgui.h b/imgui.h index 9a2313a59..69e061c34 100644 --- a/imgui.h +++ b/imgui.h @@ -30,7 +30,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') #define IMGUI_VERSION "1.93.1 WIP" -#define IMGUI_VERSION_NUM 19302 +#define IMGUI_VERSION_NUM 19303 #define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000 #define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198 diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 4a9753a89..8d27c9f3f 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -6796,19 +6796,20 @@ static void DemoWindowTables() ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags1, ImGuiTableFlags_Resizable); ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags1, ImGuiTableFlags_NoBordersInBodyUntilResize); PopStyleCompact(); - if (ImGui::BeginTable("table1", 3, flags1)) + if (ImGui::BeginTable("table1", 4, flags1)) { - // We could also set ImGuiTableFlags_SizingFixedFit on the table and all columns will default to ImGuiTableColumnFlags_WidthFixed. + // We could also set ImGuiTableFlags_SizingFixedFit on the table and all columns will default to ImGuiTableColumnFlags_WidthFixed if not specified. ImGui::TableSetupColumn("one", ImGuiTableColumnFlags_WidthFixed, 100.0f); // Default to 100.0f ImGui::TableSetupColumn("two", ImGuiTableColumnFlags_WidthFixed, 200.0f); // Default to 200.0f ImGui::TableSetupColumn("three", ImGuiTableColumnFlags_WidthFixed); // Default to auto + ImGui::TableSetupColumn("four", ImGuiTableColumnFlags_WidthStretch); // Default to remaining width ImGui::TableHeadersRow(); for (int row = 0; row < 4; row++) { ImGui::TableNextRow(); - for (int column = 0; column < 3; column++) + for (int column = 0; column < 4; column++) { - ImGui::TableSetColumnIndex(column); + ImGui::TableNextColumn(); if (row == 0) ImGui::Text("(w: %5.1f)", ImGui::GetContentRegionAvail().x); else @@ -6817,18 +6818,29 @@ static void DemoWindowTables() } ImGui::EndTable(); } + if (ImGui::BeginTable("table2", 2, flags1)) + { + // We could also set ImGuiTableFlags_SizingFixedFit on the table and all columns will default to ImGuiTableColumnFlags_WidthFixed. + ImGui::TableSetupColumn("one", ImGuiTableColumnFlags_WidthStretch, 1.0f); // Default weight + ImGui::TableSetupColumn("two", ImGuiTableColumnFlags_WidthStretch, 2.0f); // Default weight + ImGui::TableHeadersRow(); + for (int column = 0; column < 2; column++) + if (ImGui::TableNextColumn()) + ImGui::Text("Default weight %d%%", (column & 1) ? 200 : 100); + ImGui::EndTable(); + } HelpMarker( "Using TableSetupColumn() to setup explicit width.\n\nUnless _NoKeepColumnsVisible is set, " "fixed columns with set width may still be shrunk down if there's not enough space in the host."); - static ImGuiTableFlags flags2 = ImGuiTableFlags_None; + static ImGuiTableFlags flags3 = ImGuiTableFlags_None; PushStyleCompact(); - ImGui::CheckboxFlags("ImGuiTableFlags_NoKeepColumnsVisible", &flags2, ImGuiTableFlags_NoKeepColumnsVisible); - ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerV", &flags2, ImGuiTableFlags_BordersInnerV); - ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterV", &flags2, ImGuiTableFlags_BordersOuterV); + ImGui::CheckboxFlags("ImGuiTableFlags_NoKeepColumnsVisible", &flags3, ImGuiTableFlags_NoKeepColumnsVisible); + ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerV", &flags3, ImGuiTableFlags_BordersInnerV); + ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterV", &flags3, ImGuiTableFlags_BordersOuterV); PopStyleCompact(); - if (ImGui::BeginTable("table2", 4, flags2)) + if (ImGui::BeginTable("table3", 4, flags3)) { // We could also set ImGuiTableFlags_SizingFixedFit on the table and then all columns // will default to ImGuiTableColumnFlags_WidthFixed. diff --git a/imgui_internal.h b/imgui_internal.h index 1bb0ebcd6..fc1d4582c 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2161,6 +2161,7 @@ enum ImGuiLocKey : int //ImGuiLocKey_TableResetAll, ImGuiLocKey_TableResetOrder, ImGuiLocKey_TableResetVisibility, + ImGuiLocKey_TableResetSizing, ImGuiLocKey_WindowingMainMenuBar, ImGuiLocKey_WindowingPopup, ImGuiLocKey_WindowingUntitled, @@ -3241,6 +3242,7 @@ struct IMGUI_API ImGuiTable bool IsResetAllRequest; // Set to queue a call to TableResetSettings() in BeginTable() bool IsResetDisplayOrderRequest; bool IsResetVisibilityRequest; + bool IsResetSizesRequest; bool IsUnfrozenRows; // Set when we got past the frozen row. bool IsDefaultSizingPolicy; // Set if user didn't explicitly set a sizing policy in BeginTable() bool IsActiveIdAliveBeforeTable; diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 363e36806..45d596f60 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -705,7 +705,7 @@ void ImGui::TableApplyQueuedRequests(ImGuiTable* table) // table->ReorderColumn = -1; } - // Handle display order / visibility reset requests + // Handle reset requests (display order / visibility / sizes) if (table->IsResetDisplayOrderRequest) { for (int n = 0; n < table->ColumnsCount; n++) // Variant of using TableInitColumnDefaults()( @@ -720,6 +720,13 @@ void ImGui::TableApplyQueuedRequests(ImGuiTable* table) table->IsResetVisibilityRequest = false; table->IsSettingsDirty = true; } + if (table->IsResetSizesRequest) + { + for (ImGuiTableColumn& column : table->Columns) + TableInitColumnDefaults(table, &column, ImGuiTableFlags_Resizable); + table->IsResetSizesRequest = false; + table->IsSettingsDirty = true; + } } // Apply immediately. See TableQueueSetColumnDisplayOrder() for additional checks/constraints. @@ -2568,6 +2575,7 @@ void ImGui::TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n) table->AutoFitSingleColumn = (ImGuiTableColumnIdx)column_n; } +// FIXME: AutoFitQueue for Stretch columns can do a "reset" if InitStretchWeightOrWidth is valid, therefore might be misnamed. void ImGui::TableSetColumnWidthAutoAll(ImGuiTable* table) { for (int column_n = 0; column_n < table->ColumnsCount; column_n++) @@ -3759,7 +3767,7 @@ void ImGui::TableDrawDefaultContextMenu(ImGuiTable* table, ImGuiTableFlags flags } // Reset Order/Visibility etc. - if (flags_for_section_to_display & (ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable)) + if (flags_for_section_to_display & (ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Resizable)) if (BeginMenu(LocalizeGetMsg(ImGuiLocKey_TableReset))) { //if (MenuItem(LocalizeGetMsg(ImGuiLocKey_TableResetAll))) // FIXME: Hiding because altering Sort Order + requesting auto-fit simultaneously has a tendency to exhibit a sizing glitch. @@ -3770,6 +3778,9 @@ void ImGui::TableDrawDefaultContextMenu(ImGuiTable* table, ImGuiTableFlags flags if (flags_for_section_to_display & ImGuiTableFlags_Hideable) if (MenuItem(LocalizeGetMsg(ImGuiLocKey_TableResetVisibility), NULL, false, !table->IsDefaultVisibility)) table->IsResetVisibilityRequest = true; + if (flags_for_section_to_display & ImGuiTableFlags_Resizable) + if (MenuItem(LocalizeGetMsg(ImGuiLocKey_TableResetSizing), NULL, false)) // Can't easily implement IsDefaultSize + table->IsResetSizesRequest = true; EndMenu(); } From d3b36a875f0f7e7446b99606ca3d6df27b7dad7a Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 10 Nov 2026 19:56:06 +0100 Subject: [PATCH 72/72] Backends: Vulkan: ImGui_ImplVulkanH_SelectSurfaceFormat() removed unnecessary check for VK_FORMAT_UNDEFINED. (#7830) Amend 33874073dc (#1042) --- backends/imgui_impl_vulkan.cpp | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/backends/imgui_impl_vulkan.cpp b/backends/imgui_impl_vulkan.cpp index f44581030..cf4d53537 100644 --- a/backends/imgui_impl_vulkan.cpp +++ b/backends/imgui_impl_vulkan.cpp @@ -1594,33 +1594,15 @@ VkSurfaceFormatKHR ImGui_ImplVulkanH_SelectSurfaceFormat(VkPhysicalDevice physic avail_format.resize((int)avail_count); vkGetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, &avail_count, avail_format.Data); - // First check if only one format, VK_FORMAT_UNDEFINED, is available, which would imply that any format is available - if (avail_count == 1) - { - if (avail_format[0].format == VK_FORMAT_UNDEFINED) - { - VkSurfaceFormatKHR ret; - ret.format = request_formats[0]; - ret.colorSpace = request_color_space; - return ret; - } - else - { - // No point in searching another format - return avail_format[0]; - } - } - else - { - // Request several formats, the first found will be used + // When requesting several formats, the first found will be used + if (avail_count > 1) for (int request_i = 0; request_i < request_formats_count; request_i++) for (uint32_t avail_i = 0; avail_i < avail_count; avail_i++) if (avail_format[avail_i].format == request_formats[request_i] && avail_format[avail_i].colorSpace == request_color_space) return avail_format[avail_i]; - // If none of the requested image formats could be found, use the first available - return avail_format[0]; - } + // If none of the requested image formats could be found, use the first available + return avail_format[0]; } VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkPresentModeKHR* request_modes, int request_modes_count)