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")
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
#--------------------------------------------------------------------

View File

@ -197,7 +197,7 @@ extern "C" {
#include <OpenGL/glu.h>
#endif
#elif !defined(ANDROID) /*__APPLE__*/
#else /*__APPLE__*/
#include <GL/gl.h>
#if defined(GLFW_INCLUDE_GLEXT)
@ -5207,4 +5207,4 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window
}
#endif
#endif /* _glfw3_h_ */
#endif /* _glfw3_h_ */

View File

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

View File

@ -100,8 +100,7 @@ target_include_directories(glfw PUBLIC
target_include_directories(glfw PRIVATE
"${GLFW_SOURCE_DIR}/src"
"${GLFW_BINARY_DIR}/src"
${glfw_INCLUDE_DIRS}
${ANDROID_NDK}/sources/android/native_app_glue/)
${glfw_INCLUDE_DIRS})
# 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

View File

@ -82,6 +82,6 @@ void _glfwPlatformTerminate(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_LIBRARY_CONTEXT_STATE
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
struct android_app *app;
typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
typedef struct VkAndroidSurfaceCreateInfoKHR {

View File

@ -339,4 +339,4 @@ GLFWAPI struct android_app * glfwGetAndroidApp(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*)handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return window->android;
}
}

View File

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

View File

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