Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/ImGuiAppDemo/Demos/AdvancedWidgetsDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public void Render()
{
if (ImGui.BeginTabItem(TabName))
{
if (ImGui.BeginChild("##content"))
{
// Color controls
ImGui.SeparatorText("Color Controls:");
ImGui.ColorEdit3("Color RGB", ref colorPickerValue);
Expand Down Expand Up @@ -83,6 +85,9 @@ public void Render()
}
}

}
ImGui.EndChild();

ImGui.EndTabItem();
}
}
Expand Down
50 changes: 27 additions & 23 deletions examples/ImGuiAppDemo/Demos/AnimationDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,40 @@ public void Render()
{
if (ImGui.BeginTabItem(TabName))
{
ImGui.SeparatorText("Animation Examples:");
if (ImGui.BeginChild("##content"))
{
ImGui.SeparatorText("Animation Examples:");

// Simple animations
ImGui.Text("Bouncing Animation:");
Vector2 ballPos = ImGui.GetCursorScreenPos();
ballPos.Y += bounceOffset;
ImDrawListPtr drawList = ImGui.GetWindowDrawList();
drawList.AddCircleFilled(ballPos + new Vector2(50, 50), 20, ImGui.ColorConvertFloat4ToU32(new Vector4(1, 0.5f, 0, 1)));
ImGui.Dummy(new Vector2(100, 100));
// Simple animations
ImGui.Text("Bouncing Animation:");
Vector2 ballPos = ImGui.GetCursorScreenPos();
ballPos.Y += bounceOffset;
ImDrawListPtr drawList = ImGui.GetWindowDrawList();
drawList.AddCircleFilled(ballPos + new Vector2(50, 50), 20, ImGui.ColorConvertFloat4ToU32(new Vector4(1, 0.5f, 0, 1)));
ImGui.Dummy(new Vector2(100, 100));

// Pulsing element
ImGui.Text("Pulse Animation:");
Vector2 pulsePos = ImGui.GetCursorScreenPos();
float pulseSize = 20 * pulseScale;
drawList.AddCircleFilled(pulsePos + new Vector2(50, 50), pulseSize,
ImGui.ColorConvertFloat4ToU32(new Vector4(0.5f, 0, 1, 0.7f)));
ImGui.Dummy(new Vector2(100, 100));
// Pulsing element
ImGui.Text("Pulse Animation:");
Vector2 pulsePos = ImGui.GetCursorScreenPos();
float pulseSize = 20 * pulseScale;
drawList.AddCircleFilled(pulsePos + new Vector2(50, 50), pulseSize,
ImGui.ColorConvertFloat4ToU32(new Vector4(0.5f, 0, 1, 0.7f)));
ImGui.Dummy(new Vector2(100, 100));

ImGui.SeparatorText("Animated Text:");
ImGui.SliderFloat("Text Speed", ref textSpeed, 10.0f, 200.0f);
ImGui.SeparatorText("Animated Text:");
ImGui.SliderFloat("Text Speed", ref textSpeed, 10.0f, 200.0f);

for (int i = 0; i < 20; i++)
{
float wave = (MathF.Sin((animationTime * 3.0f) + (i * 0.5f)) * 0.5f) + 0.5f;
ImGui.TextColored(new Vector4(wave, 1.0f - wave, 0.5f, 1.0f), i % 5 == 4 ? " " : "▓");
if (i % 5 != 4)
for (int i = 0; i < 20; i++)
{
ImGui.SameLine();
float wave = (MathF.Sin((animationTime * 3.0f) + (i * 0.5f)) * 0.5f) + 0.5f;
ImGui.TextColored(new Vector4(wave, 1.0f - wave, 0.5f, 1.0f), i % 5 == 4 ? " " : "▓");
if (i % 5 != 4)
{
ImGui.SameLine();
}
}
}
ImGui.EndChild();

ImGui.EndTabItem();
}
Expand Down
112 changes: 58 additions & 54 deletions examples/ImGuiAppDemo/Demos/BasicWidgetsDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,62 +37,66 @@ public void Render()
{
if (ImGui.BeginTabItem(TabName))
{
ImGui.TextWrapped("This tab demonstrates basic ImGui widgets and controls.");

// Buttons
ImGui.SeparatorText("Buttons:");
if (ImGui.Button("Regular Button"))
{
counter++;
}

ImGui.SameLine();
if (ImGui.SmallButton("Small"))
if (ImGui.BeginChild("##content"))
{
counter++;
ImGui.TextWrapped("This tab demonstrates basic ImGui widgets and controls.");

// Buttons
ImGui.SeparatorText("Buttons:");
if (ImGui.Button("Regular Button"))
{
counter++;
}

ImGui.SameLine();
if (ImGui.SmallButton("Small"))
{
counter++;
}

ImGui.SameLine();
if (ImGui.ArrowButton("##left", ImGuiDir.Left))
{
counter--;
}

ImGui.SameLine();
if (ImGui.ArrowButton("##right", ImGuiDir.Right))
{
counter++;
}

ImGui.SameLine();
ImGui.Text($"Counter: {counter}");

// Checkboxes and Radio buttons
ImGui.SeparatorText("Selection Controls");
ImGui.Checkbox("Checkbox", ref checkboxState);

ImGui.RadioButton("Option 1", ref radioSelection, 0);
ImGui.SameLine();
ImGui.RadioButton("Option 2", ref radioSelection, 1);
ImGui.SameLine();
ImGui.RadioButton("Option 3", ref radioSelection, 2);

// Sliders
ImGui.SeparatorText("Sliders");
ImGui.SliderFloat("Float Slider", ref sliderValue, 0.0f, 1.0f);
ImGui.SliderFloat("Angle", ref angle, 0.0f, 360.0f, "%.1f deg");
ImGui.SliderInt("Int Slider", ref dragInt, 0, 100);

// Input fields
ImGui.SeparatorText("Input Fields");
ImGui.InputText("Text Input", ref inputText, 100);
ImGui.InputFloat("Float Input", ref dragFloat);
ImGui.InputFloat3("Vector3 Input", ref dragVector);

// Combo boxes
ImGui.SeparatorText("Dropdowns");
ImGui.Combo("Combo Box", ref comboSelection, comboItems, comboItems.Length);
ImGui.ListBox("List Box", ref listboxSelection, listboxItems, listboxItems.Length, 4);
}

ImGui.SameLine();
if (ImGui.ArrowButton("##left", ImGuiDir.Left))
{
counter--;
}

ImGui.SameLine();
if (ImGui.ArrowButton("##right", ImGuiDir.Right))
{
counter++;
}

ImGui.SameLine();
ImGui.Text($"Counter: {counter}");

// Checkboxes and Radio buttons
ImGui.SeparatorText("Selection Controls");
ImGui.Checkbox("Checkbox", ref checkboxState);

ImGui.RadioButton("Option 1", ref radioSelection, 0);
ImGui.SameLine();
ImGui.RadioButton("Option 2", ref radioSelection, 1);
ImGui.SameLine();
ImGui.RadioButton("Option 3", ref radioSelection, 2);

// Sliders
ImGui.SeparatorText("Sliders");
ImGui.SliderFloat("Float Slider", ref sliderValue, 0.0f, 1.0f);
ImGui.SliderFloat("Angle", ref angle, 0.0f, 360.0f, "%.1f deg");
ImGui.SliderInt("Int Slider", ref dragInt, 0, 100);

// Input fields
ImGui.SeparatorText("Input Fields");
ImGui.InputText("Text Input", ref inputText, 100);
ImGui.InputFloat("Float Input", ref dragFloat);
ImGui.InputFloat3("Vector3 Input", ref dragVector);

// Combo boxes
ImGui.SeparatorText("Dropdowns");
ImGui.Combo("Combo Box", ref comboSelection, comboItems, comboItems.Length);
ImGui.ListBox("List Box", ref listboxSelection, listboxItems, listboxItems.Length, 4);
ImGui.EndChild();

ImGui.EndTabItem();
}
Expand Down
26 changes: 15 additions & 11 deletions examples/ImGuiAppDemo/Demos/CleanImNodesDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,24 @@ public void Render()
{
if (ImGui.BeginTabItem(TabName))
{
// Create horizontal layout: editor on left, controls on right
ImGui.BeginTable("CleanNodeEditorLayout", 2, ImGuiTableFlags.Resizable | ImGuiTableFlags.BordersInnerV);
ImGui.TableSetupColumn("Editor", ImGuiTableColumnFlags.WidthStretch, 0.7f);
ImGui.TableSetupColumn("Controls", ImGuiTableColumnFlags.WidthStretch, 0.3f);
if (ImGui.BeginChild("##content"))
{
// Create horizontal layout: editor on left, controls on right
ImGui.BeginTable("CleanNodeEditorLayout", 2, ImGuiTableFlags.Resizable | ImGuiTableFlags.BordersInnerV);
ImGui.TableSetupColumn("Editor", ImGuiTableColumnFlags.WidthStretch, 0.7f);
ImGui.TableSetupColumn("Controls", ImGuiTableColumnFlags.WidthStretch, 0.3f);

// Editor column
ImGui.TableNextColumn();
RenderNodeEditor();
// Editor column
ImGui.TableNextColumn();
RenderNodeEditor();

// Controls column
ImGui.TableNextColumn();
RenderControlsPanel();
// Controls column
ImGui.TableNextColumn();
RenderControlsPanel();

ImGui.EndTable();
ImGui.EndTable();
}
ImGui.EndChild();

ImGui.EndTabItem();
}
Expand Down
70 changes: 37 additions & 33 deletions examples/ImGuiAppDemo/Demos/DataVisualizationDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,46 +40,50 @@ public void Render()
{
if (ImGui.BeginTabItem(TabName))
{
ImGui.SeparatorText("Real-time Data Plots:");

// Line plot
if (plotValues.Count > 0)
if (ImGui.BeginChild("##content"))
{
float[] values = [.. plotValues];
ImGui.PlotLines("Random Values", ref values[0], values.Length, 0,
$"Current: {values[^1]:F2}", 0.0f, 1.0f, new Vector2(ImGui.GetContentRegionAvail().X, 100));
ImGui.SeparatorText("Real-time Data Plots:");

ImGui.PlotHistogram("Distribution", ref values[0], values.Length, 0,
"Histogram", 0.0f, 1.0f, new Vector2(ImGui.GetContentRegionAvail().X, 100));
}
// Line plot
if (plotValues.Count > 0)
{
float[] values = [.. plotValues];
ImGui.PlotLines("Random Values", ref values[0], values.Length, 0,
$"Current: {values[^1]:F2}", 0.0f, 1.0f, new Vector2(ImGui.GetContentRegionAvail().X, 100));

// Performance note
ImGui.SeparatorText("Performance Metrics:");
ImGui.TextWrapped("Performance monitoring is now available in the Debug menu! Use 'Debug > Show Performance Monitor' to see real-time FPS graphs and throttling state.");
ImGui.PlotHistogram("Distribution", ref values[0], values.Length, 0,
"Histogram", 0.0f, 1.0f, new Vector2(ImGui.GetContentRegionAvail().X, 100));
}

// Font demonstrations
ImGui.SeparatorText("Custom Font Rendering:");
using (new FontAppearance(nameof(Resources.CARDCHAR), 16))
{
ImGui.Text("Small custom font text");
}
// Performance note
ImGui.SeparatorText("Performance Metrics:");
ImGui.TextWrapped("Performance monitoring is now available in the Debug menu! Use 'Debug > Show Performance Monitor' to see real-time FPS graphs and throttling state.");

using (new FontAppearance(nameof(Resources.CARDCHAR), 24))
{
ImGui.Text("Medium custom font text");
}
// Font demonstrations
ImGui.SeparatorText("Custom Font Rendering:");
using (new FontAppearance(nameof(Resources.CARDCHAR), 16))
{
ImGui.Text("Small custom font text");
}

using (new FontAppearance(nameof(Resources.CARDCHAR), 32))
{
ImGui.Text("Large custom font text");
}
using (new FontAppearance(nameof(Resources.CARDCHAR), 24))
{
ImGui.Text("Medium custom font text");
}

// Text formatting examples
ImGui.SeparatorText("Text Formatting:");
ImGui.TextColored(new Vector4(1, 0, 0, 1), "Red text");
ImGui.TextColored(new Vector4(0, 1, 0, 1), "Green text");
ImGui.TextColored(new Vector4(0, 0, 1, 1), "Blue text");
ImGui.TextWrapped("This is a long line of text that should wrap to multiple lines when the window is not wide enough to contain it all on a single line.");
using (new FontAppearance(nameof(Resources.CARDCHAR), 32))
{
ImGui.Text("Large custom font text");
}

// Text formatting examples
ImGui.SeparatorText("Text Formatting:");
ImGui.TextColored(new Vector4(1, 0, 0, 1), "Red text");
ImGui.TextColored(new Vector4(0, 1, 0, 1), "Green text");
ImGui.TextColored(new Vector4(0, 0, 1, 1), "Blue text");
ImGui.TextWrapped("This is a long line of text that should wrap to multiple lines when the window is not wide enough to contain it all on a single line.");
}
ImGui.EndChild();

ImGui.EndTabItem();
}
Expand Down
Loading
Loading