This commit is contained in:
2026-05-19 10:05:38 -05:00
parent 2970fdc3c6
commit 519b06367a
+54 -43
View File
@@ -25,31 +25,33 @@ public class Program
ImGui.SetNextWindowPos(viewport.WorkPos); ImGui.SetNextWindowPos(viewport.WorkPos);
ImGui.SetNextWindowSize(viewport.WorkSize); ImGui.SetNextWindowSize(viewport.WorkSize);
ImGui.SetNextWindowViewport(viewport.ID); 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) if (_fontStuff)
{ {
ImGui.SetNextWindowSize(new Vector2(250, 500), ImGuiCond.FirstUseEver); ImGui.SetNextWindowSize(new Vector2(250, 500), ImGuiCond.FirstUseEver);
@@ -123,46 +125,55 @@ public class Program
} }
} }
ImGui.Begin("Thing"); if (ImGui.Begin("Thing"))
float time = (float)ImGui.GetTime() * 5;
if (ImPlot.BeginPlot("Moving Rainbow Sine Wave"))
{ {
int count = 200; float time = (float)ImGui.GetTime() * 5;
if (ImPlot.BeginPlot("Moving Rainbow Sine Wave"))
float[] xs = new float[2];
float[] ys = new float[2];
for (int i = 0; i < count - 1; i++)
{ {
float x0 = i * 0.1f; int count = 200;
float x1 = (i + 1) * 0.1f;
float y0 = MathF.Sin(x0 * size + time); float[] xs = new float[2];
float y1 = MathF.Sin(x1 * size + time); float[] ys = new float[2];
xs[0] = x0; for (int i = 0; i < count - 1; i++)
xs[1] = x1; {
float x0 = i * 0.1f;
float x1 = (i + 1) * 0.1f;
ys[0] = y0; float y0 = MathF.Sin(x0 * size + time);
ys[1] = y1; 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)); ys[0] = y0;
float g = 0.5f + 1f * MathF.Sin(6.2831f * (t + 0.33f)); ys[1] = y1;
float b = 0.5f + 1f * MathF.Sin(6.2831f * (t + 0.66f));
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.PushStyleColor(ImPlotCol.Line, new Vector4(r, g, b, 1f));
ImPlot.PlotLine("##seg", ref xs[0], ref ys[0], 2); ImPlot.PlotLine("##seg", ref xs[0], ref ys[0], 2);
ImPlot.PopStyleColor(); ImPlot.PopStyleColor();
}
ImPlot.EndPlot();
} }
ImGui.SliderFloat("Sine", ref size, 1f, 120f);
ImPlot.EndPlot(); ImGui.End();
}
if (ImGui.Begin("ImageThing"))
{
ImGui.End();
} }
ImGui.SliderFloat("Sine", ref size, 1f, 120f);
ImGui.End();
if (_demoWindowVisible) if (_demoWindowVisible)
{ {
@@ -170,7 +181,7 @@ public class Program
} }
if (_imPlotDemoVisible) if (_imPlotDemoVisible)
{ {
ImPlot.ShowDemoWindow(ref _demoWindowVisible); ImPlot.ShowDemoWindow(ref _imPlotDemoVisible);
} }
}; };