Added ImPlot demo window to sample program

internals
Alex Hildebrand 4 years ago
parent 13ce5ecff8
commit 5f15fdf774
  1. 1
      src/ImGui.NET.SampleProgram/ImGui.NET.SampleProgram.csproj
  2. 2
      src/ImGui.NET.SampleProgram/ImGuiController.cs
  3. 15
      src/ImGui.NET.SampleProgram/Program.cs

@ -10,6 +10,7 @@
<ProjectReference Include="..\ImGui.NET\ImGui.NET.csproj" />
<PackageReference Include="Veldrid" Version="4.3.3" />
<PackageReference Include="Veldrid.StartupUtilities" Version="4.3.3" />
<ProjectReference Include="..\ImPlot.NET\ImPlot.NET.csproj" />
</ItemGroup>
<ItemGroup>

@ -61,6 +61,8 @@ namespace ImGuiNET
IntPtr context = ImGui.CreateContext();
ImGui.SetCurrentContext(context);
IntPtr implotContext = ImPlot.CreateContext();
ImPlot.SetCurrentContext(implotContext);
var fonts = ImGui.GetIO().Fonts;
ImGui.GetIO().Fonts.AddFontDefault();

@ -22,7 +22,8 @@ namespace ImGuiNET
private static int _counter = 0;
private static int _dragInt = 0;
private static Vector3 _clearColor = new Vector3(0.45f, 0.55f, 0.6f);
private static bool _showDemoWindow = true;
private static bool _showImGuiDemoWindow = true;
private static bool _showImPlotDemoWindow = false;
private static bool _showAnotherWindow = false;
private static bool _showMemoryEditor = false;
private static byte[] _memoryEditorData;
@ -89,7 +90,8 @@ namespace ImGuiNET
ImGui.Text($"Mouse position: {ImGui.GetMousePos()}");
ImGui.Checkbox("Demo Window", ref _showDemoWindow); // Edit bools storing our windows open/close state
ImGui.Checkbox("ImGui Demo Window", ref _showImGuiDemoWindow); // Edit bools storing our windows open/close state
ImGui.Checkbox("ImPlot Demo Window", ref _showImPlotDemoWindow); // Edit bools storing our windows open/close state
ImGui.Checkbox("Another Window", ref _showAnotherWindow);
ImGui.Checkbox("Memory Editor", ref _showMemoryEditor);
if (ImGui.Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
@ -114,12 +116,17 @@ namespace ImGuiNET
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui.ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (_showDemoWindow)
if (_showImGuiDemoWindow)
{
// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway.
// Here we just want to make the demo initial state a bit more friendly!
ImGui.SetNextWindowPos(new Vector2(650, 20), ImGuiCond.FirstUseEver);
ImGui.ShowDemoWindow(ref _showDemoWindow);
ImGui.ShowDemoWindow(ref _showImGuiDemoWindow);
}
if (_showImPlotDemoWindow)
{
ImPlot.ShowDemoWindow(ref _showImPlotDemoWindow);
}
if (ImGui.TreeNode("Tabs"))

Loading…
Cancel
Save