aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2018-10-08 16:12:09 +0200
committerRay <raysan5@gmail.com>2018-10-08 16:12:09 +0200
commit2d324f22a7d0e91ce5592f9529d92791797ee7df (patch)
tree0fc87a0137ab868f2801a3e132cbb6ad16b8623c /src
parent97f6454982e439850ff86b2552c9c6b4e0d8076b (diff)
downloadraylib-2d324f22a7d0e91ce5592f9529d92791797ee7df.tar.gz
raylib-2d324f22a7d0e91ce5592f9529d92791797ee7df.zip
Corrected issue with native window handler on OSX
Could not be retrieved for now...
Diffstat (limited to 'src')
-rw-r--r--src/core.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/src/core.c b/src/core.c
index f1505691..1324b883 100644
--- a/src/core.c
+++ b/src/core.c
@@ -135,42 +135,38 @@
#define CHDIR chdir
#endif
-#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
- #if defined(PLATFORM_WEB)
- #define GLFW_INCLUDE_ES2
- #endif
+#if defined(PLATFORM_DESKTOP)
//#define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3
#include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
// NOTE: GLFW3 already includes gl.h (OpenGL) headers
-
+
// Support retrieving native window handlers
#if defined(_WIN32)
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h> // WARNING: It requires customization to avoid windows.h inclusion!
+
+ #if !defined(SUPPORT_BUSY_WAIT_LOOP)
+ // NOTE: Those functions require linking with winmm library
+ unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
+ unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
+ #endif
#elif defined(__linux__)
- //#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for Font type
- //GLFW_EXPOSE_NATIVE_WAYLAND
- //GLFW_EXPOSE_NATIVE_MIR
- #endif
-
-
- #if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32)
- // NOTE: Those functions require linking with winmm library
- unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
- unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
+ #include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
+
+ //#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for Font type
+ //#define GLFW_EXPOSE_NATIVE_WAYLAND
+ //#define GLFW_EXPOSE_NATIVE_MIR
+ #include <GLFW/glfw3native.h> // Required for: glfwGetX11Window()
+ #elif defined(__APPLE__)
+ #include <unistd.h> // Required for: usleep()
+ #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_NSGL
+ #include <GLFW/glfw3native.h> // Required for: glfwGetCocoaWindow(), glfwGetNSGLContext()
#endif
#endif
-#if defined(__linux__) || defined(PLATFORM_WEB)
- #include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
-#elif defined(__APPLE__)
- #include <unistd.h> // Required for: usleep()
- #include <objc/message.h> // Required for: objc_msgsend(), sel_registerName()
- #define GLFW_EXPOSE_NATIVE_COCOA
- #define GLFW_EXPOSE_NATIVE_NSGL
- #include <GLFW/glfw3native.h> // Required for: glfwGetCocoaWindow(), glfwGetNSGLContext()
-#endif
-
#if defined(PLATFORM_ANDROID)
//#include <android/sensor.h> // Android sensors functions (accelerometer, gyroscope, light...)
#include <android/window.h> // Defines AWINDOW_FLAG_FULLSCREEN and others
@@ -205,8 +201,12 @@
#endif
#if defined(PLATFORM_WEB)
- #include <emscripten/emscripten.h>
- #include <emscripten/html5.h>
+ #define GLFW_INCLUDE_ES2 // GLFW3: Enable OpenGL ES 2.0 (translated to WebGL)
+ #include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
+ #include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
+
+ #include <emscripten/emscripten.h> // Emscripten library - LLVM to JavaScript compiler
+ #include <emscripten/html5.h> // Emscripten HTML5 library
#endif
//----------------------------------------------------------------------------------
@@ -817,7 +817,7 @@ void *GetWindowHandle(void)
return NULL; // TODO: Find a way to return value... cast to void *?
#elif defined(__APPLE__)
// NOTE: Returned handle is: void *id
- return glfwGetCocoaWindow(window);
+ return NULL; //glfwGetCocoaWindow(window); //
#else
return NULL;
#endif
@@ -2975,11 +2975,12 @@ static void SwapBuffers(void)
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
glfwSwapBuffers(window);
#if __APPLE__
- // workaround for missing/erroneous initial rendering on macOS
- if (windowNeedsUpdating) {
+ // Workaround for missing/erroneous initial rendering on macOS
+ if (windowNeedsUpdating)
+ {
// Desugared version of Objective C: [glfwGetNSGLContext(window) update]
- ((id (*)(id, SEL))objc_msgSend)(glfwGetNSGLContext(window),
- sel_registerName("update"));
+ ((id (*)(id, SEL))objc_msgSend)(glfwGetNSGLContext(window), sel_registerName("update"));
+
windowNeedsUpdating--;
}
#endif