Skip to content

Commit c071395

Browse files
committed
Update imgui to 1.90.6
1 parent b550d56 commit c071395

11 files changed

+528
-278
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
- stb_image: 2.28 ==> 2.29
118118
- luajit: 2.1-9cc2e42 ==> 2.1-d06beb0
119119
- c-ares: 1.25.0 ==> 1.28.1
120-
- imgui: 1.90.4 ==> 1.90.5
120+
- imgui: 1.90.4 ==> 1.90.6
121121

122122
## axmol-2.1.2 Feb.25 2024
123123

extensions/ImGui/src/ImGui/imgui/imgui.cpp

+232-132
Large diffs are not rendered by default.

extensions/ImGui/src/ImGui/imgui/imgui.h

+61-57
Large diffs are not rendered by default.

extensions/ImGui/src/ImGui/imgui/imgui_demo.cpp

+55-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.90.5
1+
// dear imgui, v1.90.6
22
// (demo code)
33

44
// Help:
@@ -10,6 +10,11 @@
1010
// Read top of imgui.cpp and imgui.h for many details, documentation, comments, links.
1111
// Get the latest version at https://github.com/ocornut/imgui
1212

13+
// How to easily locate code?
14+
// - Use the Item Picker to debug break in code by clicking any widgets: https://github.com/ocornut/imgui/wiki/Debug-Tools
15+
// - Browse an online version the demo with code linked to hovered widgets: https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html
16+
// - Find a visible string and search for it in the code!
17+
1318
//---------------------------------------------------
1419
// PLEASE DO NOT REMOVE THIS FILE FROM YOUR PROJECT!
1520
//---------------------------------------------------
@@ -132,6 +137,7 @@ Index of this file:
132137
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
133138
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning: macro name is a reserved identifier
134139
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
140+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access
135141
#elif defined(__GNUC__)
136142
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
137143
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size
@@ -961,13 +967,18 @@ static void ShowDemoWindowWidgets()
961967
if (i == 0)
962968
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
963969

964-
if (ImGui::TreeNode((void*)(intptr_t)i, "Child %d", i))
970+
// Here we use PushID() to generate a unique base ID, and then the "" used as TreeNode id won't conflict.
971+
// An alternative to using 'PushID() + TreeNode("", ...)' to generate a unique ID is to use 'TreeNode((void*)(intptr_t)i, ...)',
972+
// aka generate a dummy pointer-sized value to be hashed. The demo below uses that technique. Both are fine.
973+
ImGui::PushID(i);
974+
if (ImGui::TreeNode("", "Child %d", i))
965975
{
966976
ImGui::Text("blah blah");
967977
ImGui::SameLine();
968978
if (ImGui::SmallButton("button")) {}
969979
ImGui::TreePop();
970980
}
981+
ImGui::PopID();
971982
}
972983
ImGui::TreePop();
973984
}
@@ -985,7 +996,10 @@ static void ShowDemoWindowWidgets()
985996
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_OpenOnDoubleClick", &base_flags, ImGuiTreeNodeFlags_OpenOnDoubleClick);
986997
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanAvailWidth", &base_flags, ImGuiTreeNodeFlags_SpanAvailWidth); ImGui::SameLine(); HelpMarker("Extend hit area to all available width instead of allowing more items to be laid out after the node.");
987998
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanFullWidth", &base_flags, ImGuiTreeNodeFlags_SpanFullWidth);
999+
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanTextWidth", &base_flags, ImGuiTreeNodeFlags_SpanTextWidth); ImGui::SameLine(); HelpMarker("Reduce hit area to the text label and a bit of margin.");
9881000
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanAllColumns", &base_flags, ImGuiTreeNodeFlags_SpanAllColumns); ImGui::SameLine(); HelpMarker("For use in Tables only.");
1001+
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_AllowOverlap", &base_flags, ImGuiTreeNodeFlags_AllowOverlap);
1002+
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Framed", &base_flags, ImGuiTreeNodeFlags_Framed); ImGui::SameLine(); HelpMarker("Draw frame with background (e.g. for CollapsingHeader)");
9891003
ImGui::Checkbox("Align label with current X position", &align_label_with_current_x_position);
9901004
ImGui::Checkbox("Test tree node as drag source", &test_drag_and_drop);
9911005
ImGui::Text("Hello!");
@@ -1018,6 +1032,12 @@ static void ShowDemoWindowWidgets()
10181032
ImGui::Text("This is a drag and drop source");
10191033
ImGui::EndDragDropSource();
10201034
}
1035+
if (i == 2)
1036+
{
1037+
// Item 2 has an additional inline button to help demonstrate SpanTextWidth.
1038+
ImGui::SameLine();
1039+
if (ImGui::SmallButton("button")) {}
1040+
}
10211041
if (node_open)
10221042
{
10231043
ImGui::BulletText("Blah blah\nBlah Blah");
@@ -1881,7 +1901,6 @@ static void ShowDemoWindowWidgets()
18811901
ImGui::Checkbox("Animate", &animate);
18821902

18831903
// Plot as lines and plot as histogram
1884-
IMGUI_DEMO_MARKER("Widgets/Plotting/PlotLines, PlotHistogram");
18851904
static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
18861905
ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr));
18871906
ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f));
@@ -1935,15 +1954,17 @@ static void ShowDemoWindowWidgets()
19351954
ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80));
19361955
ImGui::Separator();
19371956

1957+
ImGui::TreePop();
1958+
}
1959+
1960+
IMGUI_DEMO_MARKER("Widgets/Progress Bars");
1961+
if (ImGui::TreeNode("Progress Bars"))
1962+
{
19381963
// Animate a simple progress bar
1939-
IMGUI_DEMO_MARKER("Widgets/Plotting/ProgressBar");
19401964
static float progress = 0.0f, progress_dir = 1.0f;
1941-
if (animate)
1942-
{
1943-
progress += progress_dir * 0.4f * ImGui::GetIO().DeltaTime;
1944-
if (progress >= +1.1f) { progress = +1.1f; progress_dir *= -1.0f; }
1945-
if (progress <= -0.1f) { progress = -0.1f; progress_dir *= -1.0f; }
1946-
}
1965+
progress += progress_dir * 0.4f * ImGui::GetIO().DeltaTime;
1966+
if (progress >= +1.1f) { progress = +1.1f; progress_dir *= -1.0f; }
1967+
if (progress <= -0.1f) { progress = -0.1f; progress_dir *= -1.0f; }
19471968

19481969
// Typically we would use ImVec2(-1.0f,0.0f) or ImVec2(-FLT_MIN,0.0f) to use all available width,
19491970
// or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth.
@@ -1955,6 +1976,13 @@ static void ShowDemoWindowWidgets()
19551976
char buf[32];
19561977
sprintf(buf, "%d/%d", (int)(progress_saturated * 1753), 1753);
19571978
ImGui::ProgressBar(progress, ImVec2(0.f, 0.f), buf);
1979+
1980+
// Pass an animated negative value, e.g. -1.0f * (float)ImGui::GetTime() is the recommended value.
1981+
// Adjust the factor if you want to adjust the animation speed.
1982+
ImGui::ProgressBar(-1.0f * (float)ImGui::GetTime(), ImVec2(0.0f, 0.0f), "Searching..");
1983+
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
1984+
ImGui::Text("Indeterminate");
1985+
19581986
ImGui::TreePop();
19591987
}
19601988

@@ -2089,7 +2117,7 @@ static void ShowDemoWindowWidgets()
20892117
if (side_preview)
20902118
{
20912119
ImGui::SameLine();
2092-
ImGui::Checkbox("With Object Color", &ref_color);
2120+
ImGui::Checkbox("With Ref Color", &ref_color);
20932121
if (ref_color)
20942122
{
20952123
ImGui::SameLine();
@@ -5216,7 +5244,8 @@ static void ShowDemoWindowTables()
52165244
static ImGuiTableFlags flags = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuterH | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody;
52175245

52185246
static ImGuiTreeNodeFlags tree_node_flags = ImGuiTreeNodeFlags_SpanAllColumns;
5219-
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanFullWidth", &tree_node_flags, ImGuiTreeNodeFlags_SpanFullWidth);
5247+
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanFullWidth", &tree_node_flags, ImGuiTreeNodeFlags_SpanFullWidth);
5248+
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanTextWidth", &tree_node_flags, ImGuiTreeNodeFlags_SpanTextWidth);
52205249
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanAllColumns", &tree_node_flags, ImGuiTreeNodeFlags_SpanAllColumns);
52215250

52225251
HelpMarker("See \"Columns flags\" section to configure how indentation is applied to individual columns.");
@@ -5405,6 +5434,17 @@ static void ShowDemoWindowTables()
54055434
ImGui::SliderInt("Frozen rows", &frozen_rows, 0, 2);
54065435
ImGui::CheckboxFlags("Disable header contributing to column width", &column_flags, ImGuiTableColumnFlags_NoHeaderWidth);
54075436

5437+
if (ImGui::TreeNode("Style settings"))
5438+
{
5439+
ImGui::SameLine();
5440+
HelpMarker("Giving access to some ImGuiStyle value in this demo for convenience.");
5441+
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
5442+
ImGui::SliderAngle("style.TableAngledHeadersAngle", &ImGui::GetStyle().TableAngledHeadersAngle, -50.0f, +50.0f);
5443+
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
5444+
ImGui::SliderFloat2("style.TableAngledHeadersTextAlign", (float*)&ImGui::GetStyle().TableAngledHeadersTextAlign, 0.0f, 1.0f, "%.2f");
5445+
ImGui::TreePop();
5446+
}
5447+
54085448
if (ImGui::BeginTable("table_angled_headers", columns_count, table_flags, ImVec2(0.0f, TEXT_BASE_HEIGHT * 12)))
54095449
{
54105450
ImGui::TableSetupColumn(column_names[0], ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_NoReorder);
@@ -6669,10 +6709,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
66696709
{ bool border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? 1.0f : 0.0f; } }
66706710

66716711
// Save/Revert button
6672-
if (ImGui::Button("Save Object"))
6712+
if (ImGui::Button("Save Ref"))
66736713
*ref = ref_saved_style = style;
66746714
ImGui::SameLine();
6675-
if (ImGui::Button("Revert Object"))
6715+
if (ImGui::Button("Revert Ref"))
66766716
style = *ref;
66776717
ImGui::SameLine();
66786718
HelpMarker(
@@ -6715,6 +6755,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
67156755
ImGui::SeparatorText("Tables");
67166756
ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f");
67176757
ImGui::SliderAngle("TableAngledHeadersAngle", &style.TableAngledHeadersAngle, -50.0f, +50.0f);
6758+
ImGui::SliderFloat2("TableAngledHeadersTextAlign", (float*)&style.TableAngledHeadersTextAlign, 0.0f, 1.0f, "%.2f");
67186759

67196760
ImGui::SeparatorText("Widgets");
67206761
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");

extensions/ImGui/src/ImGui/imgui/imgui_draw.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.90.5
1+
// dear imgui, v1.90.6
22
// (drawing and font code)
33

44
/*
@@ -65,6 +65,7 @@ Index of this file:
6565
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
6666
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
6767
#pragma clang diagnostic ignored "-Wreserved-identifier" // warning: identifier '_Xxx' is reserved because it starts with '_' followed by a capital letter
68+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access
6869
#elif defined(__GNUC__)
6970
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
7071
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
@@ -390,6 +391,7 @@ void ImDrawListSharedData::SetCircleTessellationMaxError(float max_error)
390391
}
391392

392393
// Initialize before use in a new frame. We always have a command ready in the buffer.
394+
// In the majority of cases, you would want to call PushClipRect() and PushTextureID() after this.
393395
void ImDrawList::_ResetForNewFrame()
394396
{
395397
// Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory.
@@ -2989,8 +2991,8 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
29892991
int unscaled_ascent, unscaled_descent, unscaled_line_gap;
29902992
stbtt_GetFontVMetrics(&src_tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);
29912993

2992-
const float ascent = ImTrunc(unscaled_ascent * font_scale + ((unscaled_ascent > 0.0f) ? +1 : -1));
2993-
const float descent = ImTrunc(unscaled_descent * font_scale + ((unscaled_descent > 0.0f) ? +1 : -1));
2994+
const float ascent = ImCeil(unscaled_ascent * font_scale);
2995+
const float descent = ImFloor(unscaled_descent * font_scale);
29942996
ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);
29952997
const float font_off_x = cfg.GlyphOffset.x;
29962998
const float font_off_y = cfg.GlyphOffset.y + IM_ROUND(dst_font->Ascent);
@@ -4085,6 +4087,8 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, Im
40854087
{
40864088
x = start_x;
40874089
y += line_height;
4090+
if (y > clip_rect.w)
4091+
break; // break out of main loop
40884092
word_wrap_eol = NULL;
40894093
s = CalcWordWrapNextLineStartA(s, text_end); // Wrapping skips upcoming blanks
40904094
continue;

0 commit comments

Comments
 (0)