This commit is contained in:
2026-05-19 10:05:38 -05:00
parent 2970fdc3c6
commit 519b06367a
+55 -44
View File
@@ -25,31 +25,33 @@ public class Program
ImGui.SetNextWindowPos(viewport.WorkPos);
ImGui.SetNextWindowSize(viewport.WorkSize);
ImGui.SetNextWindowViewport(viewport.ID);
ImGui.Begin("MainWindow", ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.MenuBar | ImGuiWindowFlags.NoDocking | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoBringToFrontOnFocus);
if (ImGui.BeginMenuBar())
if (ImGui.Begin("MainWindow", ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.MenuBar | ImGuiWindowFlags.NoDocking | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoBringToFrontOnFocus))
{
if (ImGui.BeginMenu("Stuff"))
if (ImGui.BeginMenuBar())
{
if (ImGui.MenuItem("Quit"))
if (ImGui.BeginMenu("Stuff"))
{
window.ShouldClose = true;
if (ImGui.MenuItem("Quit"))
{
window.ShouldClose = true;
}
ImGui.EndMenu();
}
ImGui.Spacing();
ImGui.MenuItem("Demo Window", "", ref _demoWindowVisible);
ImGui.Spacing();
ImGui.MenuItem("ImPlot Demo Window", "", ref _imPlotDemoVisible);
ImGui.Spacing();
ImGui.MenuItem("Font Stuff", "", ref _fontStuff);
ImGui.EndMenu();
ImGui.EndMenuBar();
}
ImGui.Spacing();
ImGui.MenuItem("Demo Window", "", ref _demoWindowVisible);
ImGui.Spacing();
ImGui.MenuItem("ImPlot Demo Window", "", ref _imPlotDemoVisible);
ImGui.Spacing();
ImGui.MenuItem("Font Stuff", "", ref _fontStuff);
ImGui.EndMenuBar();
ImGui.End();
}
ImGui.End();
if (_fontStuff)
{
ImGui.SetNextWindowSize(new Vector2(250, 500), ImGuiCond.FirstUseEver);
@@ -123,54 +125,63 @@ public class Program
}
}
ImGui.Begin("Thing");
float time = (float)ImGui.GetTime() * 5;
if (ImPlot.BeginPlot("Moving Rainbow Sine Wave"))
if (ImGui.Begin("Thing"))
{
int count = 200;
float[] xs = new float[2];
float[] ys = new float[2];
for (int i = 0; i < count - 1; i++)
float time = (float)ImGui.GetTime() * 5;
if (ImPlot.BeginPlot("Moving Rainbow Sine Wave"))
{
float x0 = i * 0.1f;
float x1 = (i + 1) * 0.1f;
int count = 200;
float y0 = MathF.Sin(x0 * size + time);
float y1 = MathF.Sin(x1 * size + time);
float[] xs = new float[2];
float[] ys = new float[2];
xs[0] = x0;
xs[1] = x1;
for (int i = 0; i < count - 1; i++)
{
float x0 = i * 0.1f;
float x1 = (i + 1) * 0.1f;
ys[0] = y0;
ys[1] = y1;
float y0 = MathF.Sin(x0 * size + time);
float y1 = MathF.Sin(x1 * size + time);
float t = i / (float)count;
xs[0] = x0;
xs[1] = x1;
float r = 0.5f + 1f * MathF.Sin(6.2831f * (t));
float g = 0.5f + 1f * MathF.Sin(6.2831f * (t + 0.33f));
float b = 0.5f + 1f * MathF.Sin(6.2831f * (t + 0.66f));
ys[0] = y0;
ys[1] = y1;
float t = i / (float)count;
float r = 0.5f + 1f * MathF.Sin(6.2831f * (t));
float g = 0.5f + 1f * MathF.Sin(6.2831f * (t + 0.33f));
float b = 0.5f + 1f * MathF.Sin(6.2831f * (t + 0.66f));
ImPlot.PushStyleColor(ImPlotCol.Line, new Vector4(r, g, b, 1f));
ImPlot.PlotLine("##seg", ref xs[0], ref ys[0], 2);
ImPlot.PopStyleColor();
ImPlot.PushStyleColor(ImPlotCol.Line, new Vector4(r, g, b, 1f));
ImPlot.PlotLine("##seg", ref xs[0], ref ys[0], 2);
ImPlot.PopStyleColor();
}
ImPlot.EndPlot();
}
ImGui.SliderFloat("Sine", ref size, 1f, 120f);
ImPlot.EndPlot();
ImGui.End();
}
ImGui.SliderFloat("Sine", ref size, 1f, 120f);
ImGui.End();
if (ImGui.Begin("ImageThing"))
{
ImGui.End();
}
if (_demoWindowVisible)
{
ImGui.ShowDemoWindow(ref _demoWindowVisible);
}
if (_imPlotDemoVisible)
{
ImPlot.ShowDemoWindow(ref _demoWindowVisible);
ImPlot.ShowDemoWindow(ref _imPlotDemoVisible);
}
};
@@ -205,4 +216,4 @@ public class Program
Console.WriteLine($"{message} | {method} | {path}:{line}");
}
}
}
}