This commit is contained in:
2026-05-20 04:23:47 -05:00
parent 96e90a09d9
commit 7d5f242a43
5 changed files with 502 additions and 454 deletions
+6 -3
View File
@@ -35,13 +35,16 @@ public sealed unsafe class SDL3Window : IDisposable
public SDL3Window(string name, int posX, int posY, int width, int height, SDL.WindowFlags flags = SDL.WindowFlags.Resizable | SDL.WindowFlags.HighPixelDensity)
{
if (OperatingSystem.IsLinux())
SDL.SetHint(SDL.Hints.VideoDriver, "x11");
if (!SDL.Init(SDL.InitFlags.Events | SDL.InitFlags.Video | SDL.InitFlags.Gamepad))
throw new Exception($"SDL_Init failed: {SDL.GetError()}");
SDL.GLSetAttribute(SDL.GLAttr.ContextFlags, (int)SDL.GLContextFlag.ForwardCompatible);
SDL.GLSetAttribute(SDL.GLAttr.ContextProfileMask, (int)SDL.GLProfile.Core);
SDL.GLSetAttribute(SDL.GLAttr.ContextMajorVersion, 3);
SDL.GLSetAttribute(SDL.GLAttr.ContextMinorVersion, 3);
SDL.GLSetAttribute(SDL.GLAttr.ContextMajorVersion, 4);
SDL.GLSetAttribute(SDL.GLAttr.ContextMinorVersion, 6);
SDL.SetHint(SDL.Hints.IMEImplementedUI, "1");
@@ -116,7 +119,7 @@ public sealed unsafe class SDL3Window : IDisposable
_gl = new GL(new BindingsContext(Window, glContext));
// Init platform and renderer
ImGuiSDL3Platform.Init(_gl, glContext, Window, this);
ImGuiSDL3Platform.Init(_gl, Window, glContext);
ImGuiSDL3Renderer.Init(_gl, "#version 330");
}