diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-26 13:18:02 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-26 13:18:02 +0100 |
| commit | a3d4977a3cb6d7e4ce4f9627842398e6ab25d9a8 (patch) | |
| tree | 7a8e786c3f7e0990196b8fef34bcc3fefe4bf29b /Backends/CairoBackend/src/ImageBackend.cs | |
| parent | 4cc76903d5556886f39dc35400f7ba5e9f732eb7 (diff) | |
skia backend wip, glfw win created in backends if null, wip
Diffstat (limited to 'Backends/CairoBackend/src/ImageBackend.cs')
| -rw-r--r-- | Backends/CairoBackend/src/ImageBackend.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Backends/CairoBackend/src/ImageBackend.cs b/Backends/CairoBackend/src/ImageBackend.cs index fa9b009e..0181451a 100644 --- a/Backends/CairoBackend/src/ImageBackend.cs +++ b/Backends/CairoBackend/src/ImageBackend.cs @@ -11,7 +11,23 @@ namespace Crow.CairoBackend /// </summary> /// <param name="width">backend surface width</param> /// <param name="height">backend surface height</param> - public ImageBackend (IntPtr nativeWindoPointer, int width, int height) : base () { + public ImageBackend (ref IntPtr nativeWindoPointer, out bool ownGlfwWinHandle, int width, int height) : base () { + if (nativeWindoPointer == IntPtr.Zero) { + Glfw3.Init (); + Glfw3.WindowHint (WindowAttribute.ClientApi, 0); + Glfw3.WindowHint (WindowAttribute.Resizable, 1); + Glfw3.WindowHint (WindowAttribute.Decorated, 1); + + hWin = Glfw3.CreateWindow (width, height, "win name", MonitorHandle.Zero, IntPtr.Zero); + if (hWin == IntPtr.Zero) + throw new Exception ("[GLFW3] Unable to create Window"); + + nativeWindoPointer = hWin; + ownGlfwWinHandle = true; + } else { + hWin = nativeWindoPointer; + ownGlfwWinHandle = false; + } switch (Environment.OSVersion.Platform) { case PlatformID.Unix: |