From 4489a530c04035acaba1bb471513b7d12fffbcb1 Mon Sep 17 00:00:00 2001 From: Greg Wells Date: Thu, 22 May 2025 19:56:32 -0400 Subject: [PATCH] write gryphn surface creation util for MacOS --- include/gryphn/gryphn.h | 1 + include/gryphn/utils/gryphn_glfw_util.h | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 include/gryphn/utils/gryphn_glfw_util.h diff --git a/include/gryphn/gryphn.h b/include/gryphn/gryphn.h index f962a2c..cb3dd32 100644 --- a/include/gryphn/gryphn.h +++ b/include/gryphn/gryphn.h @@ -1,4 +1,5 @@ #pragma once +#define GRYPHN_INCLUDE #include #include #include diff --git a/include/gryphn/utils/gryphn_glfw_util.h b/include/gryphn/utils/gryphn_glfw_util.h new file mode 100644 index 0000000..ebd89a6 --- /dev/null +++ b/include/gryphn/utils/gryphn_glfw_util.h @@ -0,0 +1,24 @@ +#pragma once +#ifndef GRYPHN_INCLUDE +#error "Must inclue gryphn.h before using this file" +#endif +#ifndef _glfw3_h_ +#error "Must include glfw before using this file" +#endif +#ifndef _glfw3_native_h_ +#error "Must include glfwnative before using this file" +#endif + +#ifdef GN_PLATFORM_MACOS +#ifndef GLFW_EXPOSE_NATIVE_COCOA +#error "Must define GLFW_EXPOSE_NATIVE_COCOA on macos" +#endif + +gnReturnCode gnCreateGLFWWindowSurface(struct gnWindowSurface_t* windowSurface, struct gnInstance_t* instance, GLFWwindow* window) { + gnMacOSWindowSurfaceInfo surfaceCreateInfo = { + .window = (NSWindow*)glfwGetCocoaWindow(window) + }; + return gnCreateMacOSWindowSurface(windowSurface, instance, surfaceCreateInfo); +} + +#endif