mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
More changes
This commit is contained in:
parent
a0d99c8b59
commit
51000fdbb7
@ -568,7 +568,6 @@ GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_ANDROID)
|
||||
#include <android_native_app_glue.h>
|
||||
GLFWAPI struct android_app * glfwGetAndroidApp(GLFWwindow* window);
|
||||
#endif
|
||||
|
||||
|
@ -63,7 +63,7 @@ elseif (_GLFW_ANDROID)
|
||||
set(glfw_HEADERS ${common_HEADERS} android_platform.h android_joystick.h
|
||||
posix_time.h posix_thread.h)
|
||||
set(glfw_SOURCES ${common_SOURCES} android_init.c android_monitor.c android_window.c
|
||||
android_joystick.c posix_time.c posix_thread.c egl_context.c osmesa_context.c ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
android_joystick.c posix_time.c posix_thread.c egl_context.c osmesa_context.c "${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
|
@ -32,7 +32,8 @@ float x,y;
|
||||
static int32_t handle_input(struct android_app* app, AInputEvent* event)
|
||||
{
|
||||
if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION)
|
||||
for (size_t i = 0; i < AMotionEvent_getPointerCount(event); ++i) {
|
||||
for (size_t i = 0; i < AMotionEvent_getPointerCount(event); ++i)
|
||||
{
|
||||
x = AMotionEvent_getX(event, i);
|
||||
y = AMotionEvent_getY(event, i);
|
||||
}
|
||||
@ -55,14 +56,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
||||
|
||||
ANativeWindow_setBuffersGeometry(window->android->window, wndconfig->width, wndconfig->height, 0);
|
||||
|
||||
if (ctxconfig->client != GLFW_NO_API) {
|
||||
if (ctxconfig->client != GLFW_NO_API)
|
||||
{
|
||||
if ((ctxconfig->source == GLFW_NATIVE_CONTEXT_API) |
|
||||
(ctxconfig->source == GLFW_EGL_CONTEXT_API)) {
|
||||
(ctxconfig->source == GLFW_EGL_CONTEXT_API))
|
||||
{
|
||||
if (!_glfwInitEGL())
|
||||
return GLFW_FALSE;
|
||||
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
} else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API) {
|
||||
}
|
||||
else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
|
||||
{
|
||||
if (!_glfwInitOSMesa())
|
||||
return GLFW_FALSE;
|
||||
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
||||
@ -70,7 +75,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
@ -110,7 +114,9 @@ void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
||||
|
||||
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
|
||||
{
|
||||
if (height)
|
||||
*height = ANativeWindow_getHeight(window->android->window);
|
||||
if (width)
|
||||
*width = ANativeWindow_getWidth(window->android->window);
|
||||
}
|
||||
|
||||
@ -225,7 +231,9 @@ void _glfwPlatformPostEmptyEvent(void)
|
||||
|
||||
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
||||
{
|
||||
if (xpos)
|
||||
*xpos = x;
|
||||
if (ypos)
|
||||
*ypos = y;
|
||||
}
|
||||
|
||||
@ -336,7 +344,7 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
|
||||
|
||||
GLFWAPI struct android_app * glfwGetAndroidApp(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*)handle;
|
||||
_GLFWwindow *window = (_GLFWwindow*)handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
return window->android;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user