Adding requested changes

This commit is contained in:
Curi0 2017-10-17 18:44:16 +05:30
parent 57dd782d2a
commit a0d99c8b59
9 changed files with 37 additions and 31 deletions

View File

@ -333,6 +333,13 @@ if (_GLFW_COCOA)
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo") set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo")
endif() endif()
#--------------------------------------------------------------------
# Use Android APIs for window creation
#--------------------------------------------------------------------
if (_GLFW_ANDROID)
list(APPEND glfw_INCLUDE_DIRS "${ANDROID_NDK}/sources/android/native_app_glue/")
endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Export GLFW library dependencies # Export GLFW library dependencies
#-------------------------------------------------------------------- #--------------------------------------------------------------------

View File

@ -197,7 +197,7 @@ extern "C" {
#include <OpenGL/glu.h> #include <OpenGL/glu.h>
#endif #endif
#elif !defined(ANDROID) /*__APPLE__*/ #else /*__APPLE__*/
#include <GL/gl.h> #include <GL/gl.h>
#if defined(GLFW_INCLUDE_GLEXT) #if defined(GLFW_INCLUDE_GLEXT)

View File

@ -123,6 +123,9 @@ extern "C" {
#include <GL/osmesa.h> #include <GL/osmesa.h>
#endif #endif
#if defined(GLFW_EXPOSE_NATIVE_ANDROID)
#include <android_native_app_glue.h>
#endif
/************************************************************************* /*************************************************************************
* Functions * Functions

View File

@ -100,8 +100,7 @@ target_include_directories(glfw PUBLIC
target_include_directories(glfw PRIVATE target_include_directories(glfw PRIVATE
"${GLFW_SOURCE_DIR}/src" "${GLFW_SOURCE_DIR}/src"
"${GLFW_BINARY_DIR}/src" "${GLFW_BINARY_DIR}/src"
${glfw_INCLUDE_DIRS} ${glfw_INCLUDE_DIRS})
${ANDROID_NDK}/sources/android/native_app_glue/)
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before # HACK: When building on MinGW, WINVER and UNICODE need to be defined before
# the inclusion of stddef.h (by glfw3.h), which is itself included before # the inclusion of stddef.h (by glfw3.h), which is itself included before

View File

@ -82,6 +82,6 @@ void _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
{ {
return _GLFW_VERSION_NUMBER " Android"; return _GLFW_VERSION_NUMBER " Android EGL";
} }

View File

@ -47,10 +47,10 @@
#define _GLFW_PLATFORM_CONTEXT_STATE #define _GLFW_PLATFORM_CONTEXT_STATE
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
struct android_app *app; struct android_app *app;
typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
typedef struct VkAndroidSurfaceCreateInfoKHR { typedef struct VkAndroidSurfaceCreateInfoKHR {

View File

@ -393,11 +393,8 @@ GLFWbool _glfwInitEGL(void)
_glfwTerminateEGL(); _glfwTerminateEGL();
return GLFW_FALSE; return GLFW_FALSE;
} }
#if !defined(ANDROID)
_glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY); _glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
#else
_glfw.egl.display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
#endif
if (_glfw.egl.display == EGL_NO_DISPLAY) if (_glfw.egl.display == EGL_NO_DISPLAY)
{ {

View File

@ -26,31 +26,31 @@
//======================================================================== //========================================================================
#if defined(_GLFW_USE_EGLPLATFORM_H) #if defined(_GLFW_USE_EGLPLATFORM_H)
#include <EGL/eglplatform.h> #include <EGL/eglplatform.h>
#elif defined(_GLFW_ANDROID) #elif defined(_GLFW_ANDROID)
#define EGLAPIENTRY #define EGLAPIENTRY
typedef void* EGLNativeDisplayType; typedef void* EGLNativeDisplayType;
typedef struct ANativeWindow* EGLNativeWindowType; typedef struct ANativeWindow* EGLNativeWindowType;
#elif defined(_GLFW_WIN32) #elif defined(_GLFW_WIN32)
#define EGLAPIENTRY __stdcall #define EGLAPIENTRY __stdcall
typedef HDC EGLNativeDisplayType; typedef HDC EGLNativeDisplayType;
typedef HWND EGLNativeWindowType; typedef HWND EGLNativeWindowType;
#elif defined(_GLFW_COCOA) #elif defined(_GLFW_COCOA)
#define EGLAPIENTRY #define EGLAPIENTRY
typedef void* EGLNativeDisplayType; typedef void* EGLNativeDisplayType;
typedef id EGLNativeWindowType; typedef id EGLNativeWindowType;
#elif defined(_GLFW_X11) #elif defined(_GLFW_X11)
#define EGLAPIENTRY #define EGLAPIENTRY
typedef Display* EGLNativeDisplayType; typedef Display* EGLNativeDisplayType;
typedef Window EGLNativeWindowType; typedef Window EGLNativeWindowType;
#elif defined(_GLFW_WAYLAND) #elif defined(_GLFW_WAYLAND)
#define EGLAPIENTRY #define EGLAPIENTRY
typedef struct wl_display* EGLNativeDisplayType; typedef struct wl_display* EGLNativeDisplayType;
typedef struct wl_egl_window* EGLNativeWindowType; typedef struct wl_egl_window* EGLNativeWindowType;
#elif defined(_GLFW_MIR) #elif defined(_GLFW_MIR)
#define EGLAPIENTRY #define EGLAPIENTRY
typedef MirEGLNativeDisplayType EGLNativeDisplayType; typedef MirEGLNativeDisplayType EGLNativeDisplayType;
typedef MirEGLNativeWindowType EGLNativeWindowType; typedef MirEGLNativeWindowType EGLNativeWindowType;
#else #else
#error "No supported EGL platform selected" #error "No supported EGL platform selected"
#endif #endif