Avoid multiple gl.h inclusions

Expose native Cocoa Window again...
This commit is contained in:
Ray 2018-10-08 18:08:39 +02:00
parent 81d28c5784
commit 2652e7d1c1
2 changed files with 9 additions and 5 deletions

View File

@ -141,7 +141,8 @@
#endif #endif
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
//#define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3 #define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3
// NOTE: Already provided by rlgl implementation (on glad.h)
#include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management #include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
// NOTE: GLFW3 already includes gl.h (OpenGL) headers // NOTE: GLFW3 already includes gl.h (OpenGL) headers
@ -166,7 +167,7 @@
#include <unistd.h> // Required for: usleep() #include <unistd.h> // Required for: usleep()
#include <objc/message.h> // Required for: objc_msgsend(), sel_registerName() #include <objc/message.h> // Required for: objc_msgsend(), sel_registerName()
//#define GLFW_EXPOSE_NATIVE_COCOA // WARNING: typedef redefinition with different types ('void *' vs 'struct objc_object *') #define GLFW_EXPOSE_NATIVE_COCOA
#define GLFW_EXPOSE_NATIVE_NSGL #define GLFW_EXPOSE_NATIVE_NSGL
#include <GLFW/glfw3native.h> // Required for: glfwGetCocoaWindow(), glfwGetNSGLContext() #include <GLFW/glfw3native.h> // Required for: glfwGetCocoaWindow(), glfwGetNSGLContext()
#endif #endif
@ -821,8 +822,8 @@ void *GetWindowHandle(void)
//unsigned long id = (unsigned long)glfwGetX11Window(window); //unsigned long id = (unsigned long)glfwGetX11Window(window);
return NULL; // TODO: Find a way to return value... cast to void *? return NULL; // TODO: Find a way to return value... cast to void *?
#elif defined(__APPLE__) #elif defined(__APPLE__)
// NOTE: Returned handle is: void *id // NOTE: Returned handle is: (objc_object *)
return NULL; //glfwGetCocoaWindow(window); // return (void *)glfwGetCocoaWindow(window);
#else #else
return NULL; return NULL;
#endif #endif

View File

@ -101,7 +101,10 @@ extern "C" {
#if defined(__OBJC__) #if defined(__OBJC__)
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#else #else
typedef void* id; // RAY: Added protection in case OBJC types defined
#if !defined(OBJC_TYPES_DEFINED)
typedef void* id;
#endif
#endif #endif
#elif defined(GLFW_EXPOSE_NATIVE_X11) #elif defined(GLFW_EXPOSE_NATIVE_X11)
#include <X11/Xlib.h> #include <X11/Xlib.h>