Skip to content

Commit 0ad6e87

Browse files
committed
Update cimgui + imgui + demos 1.90.6
1 parent cbad601 commit 0ad6e87

File tree

5 files changed

+110
-57
lines changed

5 files changed

+110
-57
lines changed

src/demo.cr

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Based on https://github.com/ocornut/imgui/blob/v1.90.5/imgui_demo.cpp
1+
# Based on https://github.com/ocornut/imgui/blob/v1.90.6/imgui_demo.cpp
22

33
require "./imgui"
44
require "./util"
@@ -678,10 +678,12 @@ module ImGuiDemo
678678
ImGui.set_next_item_open(true, ImGuiCond::Once)
679679
end
680680

681-
ImGui.tree_node(i, "Child %d", i) do
682-
ImGui.text("blah blah")
683-
ImGui.same_line
684-
if ImGui.small_button("button")
681+
ImGui.with_id(i) do
682+
ImGui.tree_node("", "Child %d", i) do
683+
ImGui.text("blah blah")
684+
ImGui.same_line
685+
if ImGui.small_button("button")
686+
end
685687
end
686688
end
687689
end
@@ -701,9 +703,16 @@ module ImGuiDemo
701703
ImGui.same_line
702704
help_marker("Extend hit area to all available width instead of allowing more items to be laid out after the node.")
703705
ImGui.checkbox_flags("ImGuiTreeNodeFlags_SpanFullWidth", pointerof(base_flags.val), ImGuiTreeNodeFlags::SpanFullWidth)
706+
ImGui.checkbox_flags("ImGuiTreeNodeFlags_SpanTextWidth", pointerof(base_flags.val), ImGuiTreeNodeFlags::SpanTextWidth)
707+
ImGui.same_line
708+
help_marker("Reduce hit area to the text label and a bit of margin.")
704709
ImGui.checkbox_flags("ImGuiTreeNodeFlags_SpanAllColumns", pointerof(base_flags.val), ImGuiTreeNodeFlags::SpanAllColumns)
705710
ImGui.same_line
706711
help_marker("For use in Tables only.")
712+
ImGui.checkbox_flags("ImGuiTreeNodeFlags_AllowOverlap", pointerof(base_flags.val), ImGuiTreeNodeFlags::AllowOverlap)
713+
ImGui.checkbox_flags("ImGuiTreeNodeFlags_Framed", pointerof(base_flags.val), ImGuiTreeNodeFlags::Framed)
714+
ImGui.same_line
715+
help_marker("Draw frame with background (e.g. for CollapsingHeader)")
707716
ImGui.checkbox("Align label with current X position", pointerof(align_label_with_current_x_position.val))
708717
ImGui.checkbox("Test tree node as drag source", pointerof(test_drag_and_drop.val))
709718
ImGui.text("Hello!")
@@ -729,6 +738,11 @@ module ImGuiDemo
729738
ImGui.text("This is a drag and drop source")
730739
ImGui.end_drag_drop_source
731740
end
741+
if i == 2
742+
ImGui.same_line
743+
if ImGui.small_button("button")
744+
end
745+
end
732746
if node_open
733747
ImGui.bullet_text("Blah blah\nBlah Blah")
734748
ImGui.tree_pop
@@ -1416,7 +1430,6 @@ module ImGuiDemo
14161430
static animate = true
14171431
ImGui.checkbox("Animate", pointerof(animate.val))
14181432

1419-
demo_marker("Widgets/Plotting/PlotLines, PlotHistogram")
14201433
static arr = [0.6f32, 0.1f32, 1.0f32, 0.5f32, 0.92f32, 0.1f32, 0.2f32]
14211434
ImGui.plot_lines("Frame Times", arr.val)
14221435
ImGui.plot_histogram("Histogram", arr.val, 0, nil, 0.0f32, 1.0f32, ImVec2.new(0, 80.0f32))
@@ -1462,20 +1475,20 @@ module ImGuiDemo
14621475
ImGui.plot_lines("Lines", display_count.val, 0, nil, -1.0f32, 1.0f32, ImVec2.new(0, 80), &func)
14631476
ImGui.plot_histogram("Histogram", display_count.val, 0, nil, -1.0f32, 1.0f32, ImVec2.new(0, 80), &func)
14641477
ImGui.separator
1478+
end
14651479

1466-
demo_marker("Widgets/Plotting/ProgressBar")
1480+
demo_marker("Widgets/Progress Bars")
1481+
ImGui.tree_node("Progress Bars") do
14671482
static progress = 0.0f32
14681483
static progress_dir = 1.0f32
1469-
if animate.val
1470-
progress.val += progress_dir.val * 0.4f32 * ImGui.get_io.delta_time
1471-
if progress.val >= +1.1f32
1472-
progress.val = +1.1f32
1473-
progress_dir.val *= -1.0f32
1474-
end
1475-
if progress.val <= -0.1f32
1476-
progress.val = -0.1f32
1477-
progress_dir.val *= -1.0f32
1478-
end
1484+
progress.val += progress_dir.val * 0.4f32 * ImGui.get_io.delta_time
1485+
if progress.val >= +1.1f32
1486+
progress.val = +1.1f32
1487+
progress_dir.val *= -1.0f32
1488+
end
1489+
if progress.val <= -0.1f32
1490+
progress.val = -0.1f32
1491+
progress_dir.val *= -1.0f32
14791492
end
14801493

14811494
ImGui.progress_bar(progress.val, ImVec2.new(0.0f32, 0.0f32))
@@ -1485,6 +1498,10 @@ module ImGuiDemo
14851498
progress_saturated = progress.val.clamp(0.0f32, 1.0f32)
14861499
buf = sprintf("%d/%d", (progress_saturated * 1753).to_i, 1753)
14871500
ImGui.progress_bar(progress.val, ImVec2.new(0f32, 0f32), buf)
1501+
1502+
ImGui.progress_bar(-1.0f32 * ImGui.get_time, ImVec2.new(0.0f32, 0.0f32), "Searching..")
1503+
ImGui.same_line(0.0f32, ImGui.get_style.item_inner_spacing.x)
1504+
ImGui.text("Indeterminate")
14881505
end
14891506

14901507
demo_marker("Widgets/Color")
@@ -4494,6 +4511,7 @@ module ImGuiDemo
44944511
static flags = ImGuiTableFlags::BordersV | ImGuiTableFlags::BordersOuterH | ImGuiTableFlags::Resizable | ImGuiTableFlags::RowBg | ImGuiTableFlags::NoBordersInBody
44954512

44964513
ImGui.checkbox_flags("ImGuiTreeNodeFlags_SpanFullWidth", pointerof(MyTreeNode.tree_node_flags), ImGuiTreeNodeFlags::SpanFullWidth)
4514+
ImGui.checkbox_flags("ImGuiTreeNodeFlags_SpanTextWidth", pointerof(MyTreeNode.tree_node_flags), ImGuiTreeNodeFlags::SpanTextWidth)
44974515
ImGui.checkbox_flags("ImGuiTreeNodeFlags_SpanAllColumns", pointerof(MyTreeNode.tree_node_flags), ImGuiTreeNodeFlags::SpanAllColumns)
44984516

44994517
help_marker("See \"Columns flags.val\" section to configure how indentation is applied to individual columns.")
@@ -4619,6 +4637,15 @@ module ImGuiDemo
46194637
ImGui.slider_int("Frozen rows", pointerof(frozen_rows.val), 0, 2)
46204638
ImGui.checkbox_flags("Disable header contributing to column width", pointerof(column_flags.val), ImGuiTableColumnFlags::NoHeaderWidth)
46214639

4640+
ImGui.tree_node("Style settings") do
4641+
ImGui.same_line
4642+
help_marker("Giving access to some ImGuiStyle value in this demo for convenience.")
4643+
ImGui.set_next_item_width(ImGui.get_font_size * 8)
4644+
ImGui.slider_angle("style.TableAngledHeadersAngle", pointerof(ImGui.get_style.table_angled_headers_angle), -50.0f32, +50.0f32)
4645+
ImGui.set_next_item_width(ImGui.get_font_size * 8)
4646+
ImGui.slider_float2("style.TableAngledHeadersTextAlign", pointerof(ImGui.get_style.table_angled_headers_text_align), 0.0f32, 1.0f32, "%.2f")
4647+
end
4648+
46224649
ImGui.table("table_angled_headers", columns_count, table_flags.val, ImVec2.new(0.0f32, text_base_height * 12)) do
46234650
ImGui.table_setup_column(column_names[0], ImGuiTableColumnFlags::NoHide | ImGuiTableColumnFlags::NoReorder)
46244651
(1...columns_count).each do |n|
@@ -5752,6 +5779,7 @@ module ImGuiDemo
57525779
ImGui.separator_text("Tables")
57535780
ImGui.slider_float2("CellPadding", pointerof(style.cell_padding), 0.0f32, 20.0f32, "%.0f")
57545781
ImGui.slider_angle("TableAngledHeadersAngle", pointerof(style.table_angled_headers_angle), -50.0f32, +50.0f32)
5782+
ImGui.slider_float2("TableAngledHeadersTextAlign", pointerof(style.table_angled_headers_text_align), 0.0f32, 1.0f32, "%.2f")
57555783

57565784
ImGui.separator_text("Widgets")
57575785
ImGui.slider_float2("WindowTitleAlign", pointerof(style.window_title_align), 0.0f32, 1.0f32, "%.2f")

src/lib.cr

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/obj.cr

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/types.cr

Lines changed: 47 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)