Remove ImPlot3D
This commit is contained in:
+8
-3
@@ -9,6 +9,7 @@ namespace SDL3_TestingSuite;
|
|||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
private static bool _demoWindowVisible = true;
|
private static bool _demoWindowVisible = true;
|
||||||
|
private static bool _imPlotDemoVisible;
|
||||||
private static bool _fontStuff;
|
private static bool _fontStuff;
|
||||||
private static readonly Dictionary<string, List<uint>?> GlyphsByName = new Dictionary<string, List<uint>?>();
|
private static readonly Dictionary<string, List<uint>?> GlyphsByName = new Dictionary<string, List<uint>?>();
|
||||||
private static bool _initialized;
|
private static bool _initialized;
|
||||||
@@ -40,6 +41,8 @@ public class Program
|
|||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
ImGui.MenuItem("Demo Window", "", ref _demoWindowVisible);
|
ImGui.MenuItem("Demo Window", "", ref _demoWindowVisible);
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
ImGui.MenuItem("ImPlot Demo Window", "", ref _imPlotDemoVisible);
|
||||||
|
ImGui.Spacing();
|
||||||
ImGui.MenuItem("Font Stuff", "", ref _fontStuff);
|
ImGui.MenuItem("Font Stuff", "", ref _fontStuff);
|
||||||
|
|
||||||
ImGui.EndMenuBar();
|
ImGui.EndMenuBar();
|
||||||
@@ -92,12 +95,12 @@ public class Program
|
|||||||
|
|
||||||
ImGui.PushFont(null, 24);
|
ImGui.PushFont(null, 24);
|
||||||
|
|
||||||
if (GlyphsByName.TryGetValue(fontName, out List<uint> glyphs2))
|
if (GlyphsByName.TryGetValue(fontName, out List<uint>? glyphs2))
|
||||||
{
|
{
|
||||||
float cursorXStart = ImGui.GetCursorPosX();
|
float cursorXStart = ImGui.GetCursorPosX();
|
||||||
float maxWidth = ImGui.GetContentRegionAvail().X;
|
float maxWidth = ImGui.GetContentRegionAvail().X;
|
||||||
|
|
||||||
foreach (uint codepoint in glyphs2)
|
foreach (uint codepoint in glyphs2!)
|
||||||
{
|
{
|
||||||
string text = char.ConvertFromUtf32((int)codepoint);
|
string text = char.ConvertFromUtf32((int)codepoint);
|
||||||
float glyphWidth = ImGui.CalcTextSize(text).X;
|
float glyphWidth = ImGui.CalcTextSize(text).X;
|
||||||
@@ -164,8 +167,10 @@ public class Program
|
|||||||
if (_demoWindowVisible)
|
if (_demoWindowVisible)
|
||||||
{
|
{
|
||||||
ImGui.ShowDemoWindow(ref _demoWindowVisible);
|
ImGui.ShowDemoWindow(ref _demoWindowVisible);
|
||||||
|
}
|
||||||
|
if (_imPlotDemoVisible)
|
||||||
|
{
|
||||||
ImPlot.ShowDemoWindow(ref _demoWindowVisible);
|
ImPlot.ShowDemoWindow(ref _demoWindowVisible);
|
||||||
// ImPlot3D.ShowDemoWindow(ref _demoWindowVisible);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
<PackageReference Include="Hexa.NET.ImGui" Version="2.2.9" />
|
<PackageReference Include="Hexa.NET.ImGui" Version="2.2.9" />
|
||||||
<PackageReference Include="Hexa.NET.ImGui.Widgets" Version="1.2.18" />
|
<PackageReference Include="Hexa.NET.ImGui.Widgets" Version="1.2.18" />
|
||||||
<PackageReference Include="Hexa.NET.ImPlot" Version="2.2.9" />
|
<PackageReference Include="Hexa.NET.ImPlot" Version="2.2.9" />
|
||||||
<PackageReference Include="Hexa.NET.ImPlot3D" Version="2.2.9" />
|
|
||||||
<PackageReference Include="Hexa.NET.Utilities" Version="2.2.12" />
|
<PackageReference Include="Hexa.NET.Utilities" Version="2.2.12" />
|
||||||
<PackageReference Include="SDL3-CS" Version="3.2.18" />
|
<PackageReference Include="SDL3-CS" Version="3.2.18" />
|
||||||
<PackageReference Include="SDL3-CS.Native" Version="3.2.18" />
|
<PackageReference Include="SDL3-CS.Native" Version="3.2.18" />
|
||||||
|
|||||||
@@ -969,7 +969,7 @@ public unsafe static class ImGuiSDL3Platform
|
|||||||
{
|
{
|
||||||
ViewPortData vd = ImGuiUserData<ViewPortData>.Get(viewport.PlatformUserData)!;
|
ViewPortData vd = ImGuiUserData<ViewPortData>.Get(viewport.PlatformUserData)!;
|
||||||
|
|
||||||
string? oldHint = SDL.GetHint(SDL.Hints.WindowActivateWhenShown);
|
string oldHint = SDL.GetHint(SDL.Hints.WindowActivateWhenShown)!;
|
||||||
|
|
||||||
SDL.SetHint(SDL.Hints.WindowActivateWhenShown, (viewport.Flags & ImGuiViewportFlags.NoFocusOnAppearing) != 0 ? "0" : "1");
|
SDL.SetHint(SDL.Hints.WindowActivateWhenShown, (viewport.Flags & ImGuiViewportFlags.NoFocusOnAppearing) != 0 ? "0" : "1");
|
||||||
|
|
||||||
|
|||||||
+12
-19
@@ -2,7 +2,6 @@
|
|||||||
using Hexa.NET.ImGui;
|
using Hexa.NET.ImGui;
|
||||||
using Hexa.NET.ImGuizmo;
|
using Hexa.NET.ImGuizmo;
|
||||||
using Hexa.NET.ImPlot;
|
using Hexa.NET.ImPlot;
|
||||||
using Hexa.NET.ImPlot3D;
|
|
||||||
using SDL3;
|
using SDL3;
|
||||||
|
|
||||||
namespace SDL3_TestingSuite.SDL3;
|
namespace SDL3_TestingSuite.SDL3;
|
||||||
@@ -12,18 +11,24 @@ public sealed unsafe class SDL3Window : IDisposable
|
|||||||
public readonly nint Window;
|
public readonly nint Window;
|
||||||
public readonly nint Renderer;
|
public readonly nint Renderer;
|
||||||
|
|
||||||
public event Action RenderCallback;
|
public readonly Vector4 DefaultClearColor = new Vector4(0.06f, 0.06f, 0.06f, 1f);
|
||||||
|
|
||||||
public Vector4 ClearColor = new Vector4(0.06f, 0.05882353f, 0.05882353f, 1f);
|
private Vector4? _clearColor;
|
||||||
|
public Vector4 ClearColor
|
||||||
|
{
|
||||||
|
get => _clearColor ?? DefaultClearColor;
|
||||||
|
set => _clearColor = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Action? RenderCallback;
|
||||||
|
|
||||||
private ImGuiContextPtr _imGuiContext;
|
private ImGuiContextPtr _imGuiContext;
|
||||||
private ImPlotContextPtr _imPlotContext;
|
private ImPlotContextPtr _imPlotContext;
|
||||||
private ImPlot3DContextPtr _imPlot3DContext;
|
|
||||||
|
|
||||||
public bool Disposed => _disposed;
|
public bool Disposed => _disposed;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
private FileSystemWatcher? _watcher;
|
private readonly FileSystemWatcher? _watcher;
|
||||||
|
|
||||||
public SDL3Window(string name, int posX, int posY, int width, int height, SDL.WindowFlags flags = SDL.WindowFlags.Resizable | SDL.WindowFlags.HighPixelDensity)
|
public SDL3Window(string name, int posX, int posY, int width, int height, SDL.WindowFlags flags = SDL.WindowFlags.Resizable | SDL.WindowFlags.HighPixelDensity)
|
||||||
{
|
{
|
||||||
@@ -41,10 +46,8 @@ public sealed unsafe class SDL3Window : IDisposable
|
|||||||
// Create ImGui context
|
// Create ImGui context
|
||||||
_imGuiContext = ImGui.CreateContext();
|
_imGuiContext = ImGui.CreateContext();
|
||||||
_imPlotContext = ImPlot.CreateContext();
|
_imPlotContext = ImPlot.CreateContext();
|
||||||
// _imPlot3DContext = ImPlot3D.CreateContext();
|
|
||||||
ImPlot.SetImGuiContext(_imGuiContext);
|
ImPlot.SetImGuiContext(_imGuiContext);
|
||||||
ImGuizmo.SetImGuiContext(_imGuiContext);
|
ImGuizmo.SetImGuiContext(_imGuiContext);
|
||||||
// ImPlot3D.SetImGuiContext(_imGuiContext);
|
|
||||||
|
|
||||||
ImGuiIOPtr io = ImGui.GetIO();
|
ImGuiIOPtr io = ImGui.GetIO();
|
||||||
io.ConfigFlags |= ImGuiConfigFlags.NavEnableKeyboard | ImGuiConfigFlags.NavEnableGamepad | ImGuiConfigFlags.DockingEnable;
|
io.ConfigFlags |= ImGuiConfigFlags.NavEnableKeyboard | ImGuiConfigFlags.NavEnableGamepad | ImGuiConfigFlags.DockingEnable;
|
||||||
@@ -60,7 +63,7 @@ public sealed unsafe class SDL3Window : IDisposable
|
|||||||
|
|
||||||
_watcher = new FileSystemWatcher(fontsPath);
|
_watcher = new FileSystemWatcher(fontsPath);
|
||||||
_watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.CreationTime;
|
_watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.CreationTime;
|
||||||
_watcher.Created += (a, b) =>
|
_watcher.Created += (_, b) =>
|
||||||
{
|
{
|
||||||
if (!File.Exists(b.FullPath)) return;
|
if (!File.Exists(b.FullPath)) return;
|
||||||
|
|
||||||
@@ -68,7 +71,7 @@ public sealed unsafe class SDL3Window : IDisposable
|
|||||||
|
|
||||||
ImGui.GetIO().AddFont(b.FullPath);
|
ImGui.GetIO().AddFont(b.FullPath);
|
||||||
};
|
};
|
||||||
_watcher.Deleted += (a, b) =>
|
_watcher.Deleted += (_, b) =>
|
||||||
{
|
{
|
||||||
if (Path.GetExtension(b.FullPath) != ".ttf") return;
|
if (Path.GetExtension(b.FullPath) != ".ttf") return;
|
||||||
|
|
||||||
@@ -180,10 +183,6 @@ public sealed unsafe class SDL3Window : IDisposable
|
|||||||
{
|
{
|
||||||
ImPlot.SetCurrentContext(_imPlotContext);
|
ImPlot.SetCurrentContext(_imPlotContext);
|
||||||
}
|
}
|
||||||
// if (_imPlot3DContext.Handle != null)
|
|
||||||
// {
|
|
||||||
// ImPlot3D.SetCurrentContext(_imPlot3DContext);
|
|
||||||
// }
|
|
||||||
|
|
||||||
ImGuiSDL3Renderer.Dispose();
|
ImGuiSDL3Renderer.Dispose();
|
||||||
ImGuiSDL3Platform.Dispose();
|
ImGuiSDL3Platform.Dispose();
|
||||||
@@ -203,12 +202,6 @@ public sealed unsafe class SDL3Window : IDisposable
|
|||||||
ImPlot.DestroyContext(_imPlotContext);
|
ImPlot.DestroyContext(_imPlotContext);
|
||||||
_imPlotContext = null;
|
_imPlotContext = null;
|
||||||
}
|
}
|
||||||
// if (_imPlot3DContext.Handle != null)
|
|
||||||
// {
|
|
||||||
// ImPlot3D.SetCurrentContext(null);
|
|
||||||
// ImPlot3D.DestroyContext(_imPlot3DContext);
|
|
||||||
// _imPlot3DContext = null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (Renderer != nint.Zero)
|
if (Renderer != nint.Zero)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user