Remove gnCreateWindowSurface, add platform specific window creation

functions
This commit is contained in:
Greg Wells
2025-05-13 17:35:17 -04:00
parent 556fa7b71c
commit f8a4ba22dd
22 changed files with 272 additions and 106 deletions

View File

@@ -54,7 +54,27 @@ gnReturnCode gnInit(gnRenderingAPI RenderingAPI) {
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateInstance, "gnCreateInstanceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyInstance, "gnDestroyInstanceFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGetPlatformLayerName, "gnGetPlatformLayerNameFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnInstanceSetWindow, "gnInstanceSetWindowFn");
// LOAD THE SET WINDOW FUNCTIONS
#ifdef GN_PLATFORM_LINUX
#ifdef GN_WINDOW_X11
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateX11WindowSurface, "gnCreateX11WindowSurfaceFn");
#endif
#ifdef GN_WINDOW_WAYLAND
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateWaylandWindowSurface, "gnCreateWaylandWindowSurfaceFn");
#endif
#endif
#ifdef GN_PLATFORM_WIN32
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateWindowsWindowSurface, "gnCreateWindowsWindowSurfaceFn");
#endif
#ifdef GN_PLATFORM_MACOS
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateMacOSWindowSurface, "gnCreateMacOSWindowSurfaceFn");
#endif
// This is stupid
gnLoadDLLFunction(gnRenderingAPILIB, gnCreateDebugger, "gnCreateDebuggerFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnDestroyDebugger, "gnDestroyDebuggerFn");
gnLoadDLLFunction(gnRenderingAPILIB, gnGetPhysicalOutputDevices, "gnGetPhysicalOutputDevicesFn");

View File

@@ -3,8 +3,7 @@
#include "application_information/gryphn_app_info.h"
#include "core/debugger/gryphn_debugger.h"
#include <core/output_device/gryphn_output_device.h>
class GLFWwindow;
#include <platform/gryphn_platform_include.h>
struct gnPlatformInstanceData;
@@ -23,7 +22,26 @@ void gnInstanceSetDebugger(gnInstance& instance, gnDebugger& debugger);
inline gnReturnCode (*gnCreateInstance)(gnInstance* instance);
inline void (*gnDestroyInstance)(gnInstance& instance);
inline gnReturnCode (*gnInstanceSetWindow)(gnInstance& instance, GLFWwindow* window);
// inline gnReturnCode (*gnInstanceSetWindow)(gnInstance& instance, GLFWwindow* window);
#ifdef GN_PLATFORM_LINUX
#ifdef GN_WINDOW_X11
inline gnReturnCode (*gnCreateX11WindowSurface)(gnInstance& instance, Display* display, Window* window);
#endif
#ifdef GN_WINDOW_WAYLAND
inline gnReturnCode (*gnCreateWaylandWindowSurface)(gnInstance& instance, wl_display* display, wl_surface* surface);
#endif
#endif
#ifdef GN_PLATFORM_WIN32
inline gnReturnCode (*gnCreateWindowsWindowSurface)(gnInstance& instance, HWND* window, HINSTANCE* instance);
#endif
#ifdef GN_PLATFORM_MACOS
inline gnReturnCode (*gnCreateMacOSWindowSurface)(gnInstance& instance, NS::Window* window, NS::View* view);
#endif
// TODO: if instance creation fails add in a query to why the instance creation failed
// Lowkey thats a lot of work tho and I dont really want to do alllllll that

View File

@@ -1,10 +1,15 @@
#pragma once
#ifdef GN_PLATFORM_LINUX
#include <platform/platform_linux/gryphn_platform_linux.h>
#elif GN_PLATFORM_MACOS
#endif
#ifdef GN_PLATFORM_MACOS
#include <platform/platform_macos/gryphn_platform_macos.h>
#elif GN_PLATFORM_WINDOWS
#endif
#ifdef GN_PLATFORM_WINDOWS
#include <platform/platform_windows/gryphn_platform_windows.h>
#endif

View File

@@ -0,0 +1,7 @@
#ifdef GN_WINDOW_X11
#include <X11/Xlib.h>
#endif
#ifdef GN_WINDOW_WAYLAND
#include <wayland-client.h>
#endif

View File

@@ -3,3 +3,9 @@
#include <utils/strings/gryphn_string.h>
#include <vector>
#include <dlfcn.h>
namespace NS {
struct Window;
struct View;
}
// #include "AppKit/NSView.hpp"