/// <summary> /// Creates a new instance of the GlfwProvider class. /// </summary> static SdlProvider() { SDL = new Lazy <Sdl> ( () => { var sdl = Sdl.GetApi(); if (SetMainReady) { sdl.SetMainReady(); } sdl.Init(InitFlags); sdl.ThrowError(); return(sdl); } ); }
/// <summary> /// Unloads the loaded <see cref="SDL" /> interface implementation. /// </summary> public static void Unload() { SDL.Value.Quit(); SDL = new Lazy <Sdl> ( () => { var sdl = Sdl.GetApi(); if (SetMainReady) { sdl.SetMainReady(); } sdl.Init(InitFlags); sdl.ThrowError(); return(sdl); } ); }
/// <summary> /// Creates a <see cref="SdlContext"/> from a native window using the given native interface. /// </summary> /// <param name="sdl">The native interface to use.</param> /// <param name="window">The native window to associate this context for.</param> /// <param name="source">The <see cref="IGLContextSource" /> to associate this context to, if any.</param> /// <param name="attributes">The attributes to eagerly pass to <see cref="Create"/>.</param> public SdlContext(Sdl sdl, Window *window, IGLContextSource?source = null, params (GLattr Attribute, int Value)[] attributes)
public unsafe SdlNativeWindow(Sdl api, Window *window) : this() { Kind = NativeWindowFlags.Sdl; Sdl = (nint)window; SysWMInfo info; api.GetVersion(&info.Version); api.GetWindowWMInfo(window, &info); // ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault switch (info.Subsystem) { case SysWMType.OS2: Kind |= NativeWindowFlags.OS2; break; case SysWMType.Haiku: Kind |= NativeWindowFlags.Haiku; break; case SysWMType.DirectFB: Kind |= NativeWindowFlags.DirectFB; break; case SysWMType.Mir: case SysWMType.Unknown: break; case SysWMType.Windows: { Kind |= NativeWindowFlags.Win32; Win32 = (info.Info.Win.Hwnd, info.Info.Win.HDC, info.Info.Win.HInstance); break; } case SysWMType.X11: { Kind |= NativeWindowFlags.X11; X11 = ((nint)info.Info.X11.Display, (nuint)info.Info.X11.Window); break; } case SysWMType.Cocoa: { Kind |= NativeWindowFlags.Cocoa; Cocoa = (nint)info.Info.Cocoa.Window; break; } case SysWMType.UIKit: { Kind |= NativeWindowFlags.UIKit; UIKit = ((nint)info.Info.UIKit.Window, info.Info.UIKit.Framebuffer, info.Info.UIKit.Colorbuffer, info.Info.UIKit.ResolveFramebuffer); break; } case SysWMType.Wayland: { Kind |= NativeWindowFlags.Wayland; Wayland = ((nint)info.Info.Wayland.Display, (nint)info.Info.Wayland.Surface); break; } case SysWMType.WinRT: { Kind |= NativeWindowFlags.WinRT; WinRT = (nint)info.Info.WinRT.Window; break; } case SysWMType.Android: { Kind |= NativeWindowFlags.Android; Android = ((nint)info.Info.Android.Window, (nint)info.Info.Android.Surface); break; } case SysWMType.Vivante: { Kind |= NativeWindowFlags.Vivante; Vivante = ((nint)info.Info.Vivante.Display, (nint)info.Info.Vivante.Window); break; } } }