Skip to content

Commit 8f75af1

Browse files
build: update imgui & implot
1 parent eba4c8e commit 8f75af1

19 files changed

Lines changed: 3827 additions & 1950 deletions

dependencies/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ remove it.
2727
### Dear ImGui & ImPlot
2828

2929
These are not dependencies however, they are currently vendored since they are hardcoded into the experimental glfw backend. Once the current backends are further along to where Dear ImGui can be entirely integrated on the user side,
30-
these will most likely be removed. We are currently using v1.92.6 of Dear ImGui and v0.17 of ImPlot
30+
these will most likely be removed. We are currently using v1.92.7 of Dear ImGui and v1.0 of ImPlot
3131

3232
[Dear ImGui Repository](https://github.com/ocornut/imgui/tree/docking)
3333

dependencies/imgui/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014-2025 Omar Cornut
3+
Copyright (c) 2014-2026 Omar Cornut
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

dependencies/imgui/imgui.cpp

Lines changed: 212 additions & 73 deletions
Large diffs are not rendered by default.

dependencies/imgui/imgui.h

Lines changed: 65 additions & 37 deletions
Large diffs are not rendered by default.

dependencies/imgui/imgui_demo.cpp

Lines changed: 373 additions & 229 deletions
Large diffs are not rendered by default.

dependencies/imgui/imgui_draw.cpp

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.92.6
1+
// dear imgui, v1.92.8 WIP
22
// (drawing and font code)
33

44
/*
@@ -668,7 +668,7 @@ void ImDrawList::PushClipRect(const ImVec2& cr_min, const ImVec2& cr_max, bool i
668668
if (intersect_with_current_clip_rect)
669669
{
670670
ImVec4 current = _CmdHeader.ClipRect;
671-
if (cr.x < current.x) cr.x = current.x;
671+
if (cr.x < current.x) cr.x = current.x; // = ClipWith(). Note that passing inverted range wouldn't be fixed here.
672672
if (cr.y < current.y) cr.y = current.y;
673673
if (cr.z > current.z) cr.z = current.z;
674674
if (cr.w > current.w) cr.w = current.w;
@@ -1318,7 +1318,7 @@ void ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, floa
13181318
{
13191319
const float arc_length = ImAbs(a_max - a_min);
13201320
const int circle_segment_count = _CalcCircleAutoSegmentCount(radius);
1321-
const int arc_segment_count = ImMax((int)ImCeil(circle_segment_count * arc_length / (IM_PI * 2.0f)), (int)(2.0f * IM_PI / arc_length));
1321+
const int arc_segment_count = ImMax((int)ImCeil(circle_segment_count * arc_length / (IM_PI * 2.0f)), 1);
13221322
_PathArcToN(center, radius, a_min, a_max, arc_segment_count);
13231323
}
13241324
}
@@ -1438,35 +1438,21 @@ void ImDrawList::PathBezierQuadraticCurveTo(const ImVec2& p2, const ImVec2& p3,
14381438
}
14391439
}
14401440

1441-
static inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags)
1442-
{
1443-
/*
1444-
IM_STATIC_ASSERT(ImDrawFlags_RoundCornersTopLeft == (1 << 4));
1445-
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1446-
// Obsoleted in 1.82 (from February 2021). This code was stripped/simplified and mostly commented in 1.90 (from September 2023)
1447-
// - Legacy Support for hard coded ~0 (used to be a suggested equivalent to ImDrawCornerFlags_All)
1448-
if (flags == ~0) { return ImDrawFlags_RoundCornersAll; }
1449-
// - Legacy Support for hard coded 0x01 to 0x0F (matching 15 out of 16 old flags combinations). Read details in older version of this code.
1450-
if (flags >= 0x01 && flags <= 0x0F) { return (flags << 4); }
1451-
// We cannot support hard coded 0x00 with 'float rounding > 0.0f' --> replace with ImDrawFlags_RoundCornersNone or use 'float rounding = 0.0f'
1452-
#endif
1453-
*/
1454-
// If this assert triggers, please update your code replacing hardcoded values with new ImDrawFlags_RoundCorners* values.
1455-
// Note that ImDrawFlags_Closed (== 0x01) is an invalid flag for AddRect(), AddRectFilled(), PathRect() etc. anyway.
1456-
// See details in 1.82 Changelog as well as 2021/03/12 and 2023/09/08 entries in "API BREAKING CHANGES" section.
1457-
IM_ASSERT((flags & 0x0F) == 0 && "Misuse of legacy hardcoded ImDrawCornerFlags values!");
1458-
1459-
if ((flags & ImDrawFlags_RoundCornersMask_) == 0)
1460-
flags |= ImDrawFlags_RoundCornersAll;
1461-
1462-
return flags;
1463-
}
1464-
14651441
void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDrawFlags flags)
14661442
{
14671443
if (rounding >= 0.5f)
14681444
{
1469-
flags = FixRectCornerFlags(flags);
1445+
// If this assert triggers on legacy code, please update your code replacing hardcoded values with ImDrawFlags_RoundCorners* values.
1446+
// - See details in 1.82 Changelog as well as 2021/03/12 and 2023/09/08 entries in "API BREAKING CHANGES" section.
1447+
// - Note that ImDrawFlags_Closed (== 0x01) is an invalid flag for AddRect(), AddRectFilled(), PathRect() etc. anyway.
1448+
// - Marked obsolete in 1.82 and completely removed in 1.90:
1449+
// - Hard coded support for ~0 == ImDrawFlags_RoundCornersAll.
1450+
// - Hard coded support for values 0x01 to 0x0F (matching 15 out of 16 old flags combinations) --> see FixRectCornerFlags() in <1.90 code.
1451+
// - Hard coded 0x00 with 'float rounding > 0.0f' --> replace with ImDrawFlags_RoundCornersNone or use 'float rounding = 0.0f'
1452+
IM_ASSERT((flags & 0x0F) == 0 && "Misuse of legacy hardcoded ImDrawCornerFlags values!");
1453+
if ((flags & ImDrawFlags_RoundCornersMask_) == 0)
1454+
flags |= ImDrawFlags_RoundCornersAll;
1455+
14701456
rounding = ImMin(rounding, ImFabs(b.x - a.x) * (((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f) - 1.0f);
14711457
rounding = ImMin(rounding, ImFabs(b.y - a.y) * (((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f) - 1.0f);
14721458
}
@@ -1782,7 +1768,10 @@ void ImDrawList::AddImageRounded(ImTextureRef tex_ref, const ImVec2& p_min, cons
17821768
if ((col & IM_COL32_A_MASK) == 0)
17831769
return;
17841770

1785-
flags = FixRectCornerFlags(flags);
1771+
IM_ASSERT((flags & 0x0F) == 0 && "Misuse of legacy hardcoded ImDrawCornerFlags values!"); // If this assert triggers on legacy code: see comments in ImDrawList::PathRect().
1772+
if ((flags & ImDrawFlags_RoundCornersMask_) == 0)
1773+
flags |= ImDrawFlags_RoundCornersAll;
1774+
17861775
if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)
17871776
{
17881777
AddImage(tex_ref, p_min, p_max, uv_min, uv_max, col);
@@ -3056,7 +3045,7 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg_in)
30563045
}
30573046
else
30583047
{
3059-
IM_ASSERT(Fonts.Size > 0 && "Cannot use MergeMode for the first font"); // When using MergeMode make sure that a font has already been added before.
3048+
IM_ASSERT(Fonts.Size > 0 && "Cannot use MergeMode for the first font!"); // When using MergeMode make sure that a font has already been added before.
30603049
font = font_cfg_in->DstFont ? font_cfg_in->DstFont : Fonts.back();
30613050
ImFontAtlasFontDiscardBakes(this, font, 0); // Need to discard bakes if the font was already used, because baked->FontLoaderDatas[] will change size. (#9162)
30623051
}
@@ -3084,6 +3073,11 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg_in)
30843073
IM_ASSERT(font_cfg->FontLoader->FontBakedLoadGlyph != NULL);
30853074
IM_ASSERT(font_cfg->FontLoader->LoaderInit == NULL && font_cfg->FontLoader->LoaderShutdown == NULL); // FIXME-NEWATLAS: Unsupported yet.
30863075
}
3076+
// | Target w/ Implicit RefSize | Target w/ Explicit RefSize |
3077+
// Adding w/ Implicit RefSize: | OK (same scale) | OK (same scale) |
3078+
// Adding w/ Explicit RefSize: | KO | OK (custom scale) |
3079+
if (font_cfg_in->MergeMode && font_cfg_in->SizePixels > 0)
3080+
IM_ASSERT((font->Flags & ImFontFlags_ImplicitRefSize) == 0 && "Cannot use MergeMode with an explicit reference size when the destination font used an implicit reference size!");
30873081
IM_ASSERT(font_cfg->FontLoaderData == NULL);
30883082

30893083
if (!ImFontAtlasFontSourceInit(this, font_cfg))
@@ -3151,7 +3145,10 @@ ImFont* ImFontAtlas::AddFontDefaultBitmap(const ImFontConfig* font_cfg_template)
31513145
if (!font_cfg_template)
31523146
font_cfg.PixelSnapH = true; // Prevents sub-integer scaling factors at lower-level layers.
31533147
if (font_cfg.SizePixels <= 0.0f)
3148+
{
31543149
font_cfg.SizePixels = 13.0f; // This only serves (1) as a reference for GlyphOffset.y setting and (2) as a default for pre-1.92 backend.
3150+
font_cfg.Flags |= ImFontFlags_ImplicitRefSize;
3151+
}
31553152
if (font_cfg.Name[0] == '\0')
31563153
ImFormatString(font_cfg.Name, IM_COUNTOF(font_cfg.Name), "ProggyClean.ttf");
31573154
font_cfg.EllipsisChar = (ImWchar)0x0085;
@@ -3176,7 +3173,10 @@ ImFont* ImFontAtlas::AddFontDefaultVector(const ImFontConfig* font_cfg_template)
31763173
if (!font_cfg_template)
31773174
font_cfg.PixelSnapH = true; // Precisely match ProggyClean, but prevents sub-integer scaling factors at lower-level layers.
31783175
if (font_cfg.SizePixels <= 0.0f)
3176+
{
31793177
font_cfg.SizePixels = 13.0f;
3178+
font_cfg.Flags |= ImFontFlags_ImplicitRefSize;
3179+
}
31803180
if (font_cfg.Name[0] == '\0')
31813181
ImFormatString(font_cfg.Name, IM_COUNTOF(font_cfg.Name), "ProggyForever.ttf");
31823182
font_cfg.ExtraSizeScale *= 1.015f; // Match ProggyClean
@@ -3209,15 +3209,15 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels,
32093209
ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
32103210
if (font_cfg.Name[0] == '\0')
32113211
{
3212-
// Store a short copy of filename into into the font name for convenience
3212+
// Store a short copy of filename into the font name for convenience
32133213
const char* p;
32143214
for (p = filename + ImStrlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
32153215
ImFormatString(font_cfg.Name, IM_COUNTOF(font_cfg.Name), "%s", p);
32163216
}
32173217
return AddFontFromMemoryTTF(data, (int)data_size, size_pixels, &font_cfg, glyph_ranges);
32183218
}
32193219

3220-
// NB: Transfer ownership of 'ttf_data' to ImFontAtlas, unless font_cfg_template->FontDataOwnedByAtlas == false. Owned TTF buffer will be deleted after Build().
3220+
// NB: Transfer ownership of 'font_data' to ImFontAtlas, unless font_cfg_template->FontDataOwnedByAtlas == false. Owned TTF buffer will be deleted after Build().
32213221
ImFont* ImFontAtlas::AddFontFromMemoryTTF(void* font_data, int font_data_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
32223222
{
32233223
IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas!");
@@ -3264,7 +3264,9 @@ void ImFontAtlasBuildNotifySetFont(ImFontAtlas* atlas, ImFont* old_font, ImFont*
32643264
shared_data->Font = new_font;
32653265
if (ImGuiContext* ctx = shared_data->Context)
32663266
{
3267-
if (ctx->FrameCount == 0 && old_font == NULL) // While this should work either way, we save ourselves the bother / debugging confusion of running ImGui code so early when it is not needed.
3267+
// While this should work either way, we save ourselves the bother / debugging confusion of running ImGui code so early when it is not needed.
3268+
// Also fixes erroneously rewriting style.FontSizeBase during init if adding default fonts.
3269+
if (old_font == NULL && ctx->Font == NULL && ctx->FontSizeBase == 0.0f)
32683270
continue;
32693271

32703272
if (ctx->IO.FontDefault == old_font)

0 commit comments

Comments
 (0)