diff --git a/Program.cs b/Program.cs
index 28c5279..1193296 100644
--- a/Program.cs
+++ b/Program.cs
@@ -5,7 +5,6 @@ using Hexa.NET.ImGui;
using Hexa.NET.ImPlot;
using HexaGen.Runtime;
using SDL3_TestingSuite.SDL3;
-using SDL3;
namespace SDL3_TestingSuite;
diff --git a/SDL3 TestingSuite.csproj b/SDL3 TestingSuite.csproj
index 27eea50..7494761 100644
--- a/SDL3 TestingSuite.csproj
+++ b/SDL3 TestingSuite.csproj
@@ -16,10 +16,10 @@
+
-
diff --git a/SDL3/OpenGLTexture.cs b/SDL3/OpenGLTexture.cs
index 2b484eb..0d20ea9 100644
--- a/SDL3/OpenGLTexture.cs
+++ b/SDL3/OpenGLTexture.cs
@@ -1,5 +1,4 @@
using System.Numerics;
-using Elements.Assets;
using Hexa.NET.ImGui;
using Hexa.NET.OpenGL;
using SDL3;
@@ -55,31 +54,6 @@ public sealed unsafe class OpenGLTexture : IDisposable
}
}
- public static OpenGLTexture FromBitmap2D(GL gl, Bitmap2D bmp)
- {
- if (bmp == null) throw new ArgumentNullException(nameof(bmp));
-
- int width = bmp.Size.x;
- int height = bmp.Size.y;
- // Ensure we upload RGBA8 as unsigned bytes
- byte[] pixels = new byte[width * height * 4];
- for (int y = 0; y < height; ++y)
- {
- for (int x = 0; x < width; ++x)
- {
- var p = bmp.GetPixel32(x, y);
- int idx = (y * width + x) * 4;
- pixels[idx + 0] = p.r;
- pixels[idx + 1] = p.g;
- pixels[idx + 2] = p.b;
- pixels[idx + 3] = p.a;
- }
- }
-
- uint tex = UploadRgba32FromPixels(gl, pixels, width, height);
- return new OpenGLTexture(gl, tex, width, height);
- }
-
public static OpenGLTexture FromSurface(GL gl, nint surface, string? path = null)
{
if (surface == nint.Zero)
diff --git a/SDL3/SDL3Window.cs b/SDL3/SDL3Window.cs
index 5d3cfad..a46f1b3 100644
--- a/SDL3/SDL3Window.cs
+++ b/SDL3/SDL3Window.cs
@@ -2,6 +2,7 @@
using Hexa.NET.ImGui;
using Hexa.NET.ImGuizmo;
using Hexa.NET.ImPlot;
+using Hexa.NET.ImNodes;
using Hexa.NET.OpenGL;
using HexaGen.Runtime;
using SDL3;
@@ -23,10 +24,14 @@ public sealed unsafe class SDL3Window : IDisposable
public event Action? RenderCallback;
public event Action? Disposing;
+ public event Action? Resized;
+ public event Action? EventCallback;
private ImGuiContextPtr _imGuiContext;
private ImPlotContextPtr _imPlotContext;
-
+ private ImNodesContextPtr _imNodesContext;
+ // private ImPLot3DContextPtr _imPlot3DContext;
+
public bool Disposed => _disposed;
private bool _disposed;
@@ -71,9 +76,13 @@ public sealed unsafe class SDL3Window : IDisposable
// Create ImGui context
_imGuiContext = ImGui.CreateContext();
_imPlotContext = ImPlot.CreateContext();
+ _imNodesContext = ImNodes.CreateContext();
+ // _imPlot3DContext = ImPlot3D.CreateContext();
ImPlot.SetImGuiContext(_imGuiContext);
ImGuizmo.SetImGuiContext(_imGuiContext);
-
+ ImNodes.SetImGuiContext(_imGuiContext);
+ // ImPlot3D.SetImGuiContext(_imGuiContext);
+
ImGuiIOPtr io = ImGui.GetIO();
io.ConfigFlags |= ImGuiConfigFlags.NavEnableKeyboard | ImGuiConfigFlags.NavEnableGamepad | ImGuiConfigFlags.DockingEnable;
io.ConfigFlags |= ImGuiConfigFlags.ViewportsEnable;
@@ -143,7 +152,15 @@ public sealed unsafe class SDL3Window : IDisposable
case SDL.EventType.Quit:
ShouldClose = true;
break;
+ case SDL.EventType.WindowResized:
+ case SDL.EventType.WindowMoved:
+ SDL.GetWindowSize(Window, out int w, out int h);
+ SDL.GetWindowPosition(Window, out int x, out int y);
+ Resized?.Invoke(new Vector4(x, y, w, h));
+ break;
}
+
+ EventCallback?.Invoke(ev);
}
if (SDL.GetWindowFlags(Window).HasFlag(SDL.WindowFlags.Minimized))
@@ -238,6 +255,18 @@ public sealed unsafe class SDL3Window : IDisposable
ImPlot.DestroyContext(_imPlotContext);
_imPlotContext = null;
}
+ if (_imNodesContext.Handle != null)
+ {
+ ImNodes.SetCurrentContext(null);
+ ImNodes.DestroyContext(_imNodesContext);
+ _imNodesContext = null;
+ }
+ // if (_imPlot3DContext.Handle != null)
+ // {
+ // ImPlot3D.SetCurrentContext(null);
+ // ImPlot3D.DestroyContext(_imPlot3DContext);
+ // _imPlot3DContext = null;
+ // }
// if (Renderer != nint.Zero)
// {